0

我必须为TitleBarDockWindow 着色。我可以为正常着色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 做同样的事情

4

1 回答 1

1

在codeplex的 Windows 窗体项目中使用绘制自定义边框。这个项目是一个小型库,它扩展了 Windows 窗体,能够自定义 Windows 的非客户区

于 2012-08-13T08:18:06.990 回答