I have to color the TitleBar
of DockWindow. I can able to color the normal winform Titlebar color
..but I don't know how to change the color of dockwindow titlebar
if it is docked right,left,top,bottom.
[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);
}
}
}
By using this i can able to paint the titlebar of Normal winform..But i cant do this same for Dockwindow
Use Drawing Custom Borders in Windows Forms project from codeplex . This project is a small library that extends Windows Forms with ability to customize the windows's non-client area .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.