0

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

Aravind
  • 1,055
  • 2
  • 11
  • 15

1 Answers1

1

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.

Ria
  • 10,237
  • 3
  • 33
  • 60
  • You can learn how to customize the windows's non-client area like `TitleBar` – Ria Aug 13 '12 at 08:21
  • @ Ria just see on top pls..i made a code for normal winform so that i can able to change the title bar of Winform..but if i made the same thing for dockwindow its not working – Aravind Aug 13 '12 at 08:27