Changing the default border color/appearrance of WindowsForms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Short of globally changing the appearance of a WindowsForm's border color, appearrance...(like changing the color scheme in Display Properties), is there a way to change simple things like the border color at the application level

Michael
 
You must paint it yourself. Catch the WM_NCPAINT event which is the one responsible for the painting outside the client area. Then get a DeviceContext using GetDCEx and draw the border. After that create a region that equals the rectangle you just drawn and subsract it from the clip region. In WM_NCPAINT the WParam is actually a pointer to a clip region, so you can do something like this

ptr3 = new IntPtr(GDI.CreateRectRgn((rect1.Left + 4), (rect1.Top + 4), (rect1.Right - 4), (rect1.Bottom - 4)))

assuming that the border width is 4. Then set Wparam = ptr2, set msg.Result = 1 and return. In this way the original paint routine will no longer paint it for you..

Something like that. Or you can find a out of the box window skinning component..

regards
Iulia
 
Back
Top