Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2004

Tip: Looking for answers? Try searching our database.

Changing the default border color/appearrance of WindowsForms

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
michael - 27 Feb 2004 01:36 GMT
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
Iulian Ionescu - 27 Feb 2004 03:01 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.