Form1のコンストラクタで各種EnableVisualStyleを使っている事を前提としています。なお、以下の元のコードは、http://d.hatena.ne.jp/iseebi/20100521/p1 を参考にしています。
C#
[DllImport("coredll.dll")] private static extern int SendMessage( IntPtr hWnd, uint Msg, int wParam, int lParam); const int LVS_EX_THEME = 0x02000000; const int LVM_SETEXTENDEDLISTVIEWSTYLE = 0x1000 + 54; const int LVM_GETEXTENDEDLISTVIEWSTYLE = 0x1000 + 55; public void EnableVisualStyle(ListView listView) { int style = SendMessage(listView.Handle, (uint)LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0); SendMessage(listView.Handle, (uint)LVM_SETEXTENDEDLISTVIEWSTYLE, 0, style | LVS_EX_THEME); }
適用前







