我必须为TitleBar
DockWindow 着色。我可以为正常着色winform Titlebar color
..但我不知道如何更改dockwindow titlebar
停靠在右、左、上、下的颜色。
[DllImport("User32.dll", CharSet = CharSet.Auto)]
public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC);
[DllImport("User32.dll")]
private static extern IntPtr GetWindowDC(IntPtr hWnd);
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
const int WM_NCPAINT = 0x85;
if (m.Msg == WM_NCPAINT)
{
IntPtr hdc = GetWindowDC(m.HWnd);
if ((int)hdc != 0)
{
Graphics g = Graphics.FromHdc(hdc);
g.FillRectangle(Brushes.Green, new Rectangle(0, 0, 4800, 23));
//(0, 0, 400, 252));
g.Flush();
ReleaseDC(m.HWnd, hdc);
}
}
}
通过使用它,我可以绘制 Normal winform 的标题栏。但我不能对 Dockwindow 做同样的事情