Painting the title bar
C#
1
Posts
1
Posters
0
Views
1
Watching
-
Please check following codes, it dosen'g work properly, the title bar is still empty. ( the method PanitNonClientArea(Graphics, RectangleF) can work properly. )
protected override void WndProc(ref Message m) { Graphics g; RectangleF rectf; Point pt; switch (m.Msg) { case WMConsts.WM_NCPAINT : IntPtr hrgn = m.WParam; if ( hrgn != (IntPtr)1 ) { Region rgn = Region.FromHrgn(hrgn); g = CreateGraphics(); rectf = rgn.GetBounds(g); PaintNonClientArea(g, rectf); } else { g = CreateGraphics(); rectf = new RectangleF(0,-23, Width, 23); PaintNonClientArea(g, rectf); g.Dispose(); } //base.WndProc(ref m); break; default : base.WndProc (ref m); break; } }