OSDN Git Service

AppliStation-GUI,ListViewのちらつき防止。
authorttp <ttp@users.sourceforge.jp>
Sat, 6 Sep 2008 14:34:12 +0000 (14:34 +0000)
committerttp <ttp@users.sourceforge.jp>
Sat, 6 Sep 2008 14:34:12 +0000 (14:34 +0000)
ListViewのVistaでのグラデーションのかかった表示をしている際に、非常にちらつきが目立っていた。これをダブルバッファリングするようにSendMessageすることでちらつきを解決した。

git-svn-id: http://localhost/svn/AppliStation/trunk@968 34ed2c89-c49f-4a4b-abdb-c318350108cf

AppliStation/AppliStation.Util/NativeMethods.cs
AppliStation/InstallationConfirmForm.cs
AppliStation/PackageListViewForm.cs

index b56ce38..36481b0 100644 (file)
@@ -105,29 +105,26 @@ namespace AppliStation.Util
                \r
                #region ListView関連\r
                \r
-               #region 選択の半透明(コメント)\r
-               /*\r
                /// <summary>\r
-               /// ã\83\9eã\82¦ã\82¹ã\81§ã\81®é\81¸æ\8a\9eã\81«å\8d\8aé\80\8fæ\98\8eã\83\84ã\83¼ã\83«ã\82\92æ\8e¡ç\94¨する\r
+               /// ã\83ªã\82¹ã\83\88ã\83\93ã\83¥ã\83¼ã\81«ã\83\80ã\83\96ã\83«ã\83\90ã\83\83ã\83\95ã\82¡ã\81§ã\81®æ\8f\8fç\94»ã\82\92ã\81\99ã\82\8bã\81\8bå\90¦ã\81\8bã\82\92設å®\9aする\r
                /// </summary>\r
+               /// <remarks>マウスでの選択に半透明ツールを採用するか否かもこの設定に依存</remarks>\r
                /// <param name="listView">対象のリストビュー</param>\r
-               public static void ListView_EnableDoubleBuffer(ListView listView)\r
+               /// <param name="bEnable">ダブルバッファでの描画をするとき<code>true</code></param>\r
+               public static void ListView_SetDoubleBuffer(ListView listView, bool bEnable)\r
                {\r
                        try {\r
-                               // SendMessage(listView.Handle, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_DOUBLEBUFFER, LVS_EX_DOUBLEBUFFER);\r
-                               SendMessage(listView.Handle, 0x1036, 0x00010000, 0x00010000);\r
+                               // SendMessage(listView.Handle, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_DOUBLEBUFFER, bEnable? LVS_EX_DOUBLEBUFFER:0);\r
+                               SendMessage(listView.Handle, 0x1036, 0x00010000, ((bEnable)? 0x00010000u:0x0u));\r
                        } catch (Exception) {\r
                        }\r
                }\r
-               */\r
-               #endregion\r
                \r
                /// <summary>\r
                /// 選択されたアイテムの部分の背景にグラデーションがかかった感じになる、\r
                /// Vista以降でのエクスプローラの見た目をListViewに反映させる。\r
-               /// \r
-               /// なお、Vista未満のバージョンでは何もしない。\r
                /// </summary>\r
+               /// <remarks>Vista未満のバージョンでは何もしない。</remarks>\r
                /// <param name="listView">対象のListView</param>\r
                public static void ListView_EnableVistaExplorerTheme(ListView listView)\r
                {\r
index 02dcdd7..9cc7f04 100644 (file)
@@ -54,6 +54,7 @@ namespace AppliStation
                                runasCheckBox.Visible = false;\r
                        }\r
                        AppliStation.Util.NativeMethods.ListView_EnableVistaExplorerTheme(instsListView);\r
+                       AppliStation.Util.NativeMethods.ListView_SetDoubleBuffer(instsListView, true);\r
                }\r
                \r
                /// <summary>\r
index 4b5dfaa..3736ba3 100644 (file)
@@ -29,6 +29,7 @@ namespace AppliStation
                        \r
                        this.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);\r
                        AppliStation.Util.NativeMethods.ListView_EnableVistaExplorerTheme(packageListView);\r
+                       AppliStation.Util.NativeMethods.ListView_SetDoubleBuffer(packageListView, true);\r
                }\r
                \r
                private void ShowInfoToDetailBoxFor(Package pkg)\r