• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • Last Modified:

Changing colour of border around dialog

Hi

Is there a way to change the colour of the border around a form/dialog in VB.Net e.g. in the picture below I want to change the colour of the area marked by the arrow.

Issac
changecolordialogborder.png
0
IssacJones
Asked:
IssacJones
  • 2
1 Solution
 
Carlos VillegasFull Stack .NET DeveloperCommented:
You can't, that area is handled by Windows, you will need code to change that style (system wide), but it will affect all the system, or, you will need to rely on your own window border implementation.
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
The titlebar is part of the "non-client area" of the Form.  It is indeed possible to draw that in a different color by handing the various WM_NC*** messages (NC = Non-Client):
http://msdn.microsoft.com/en-us/library/dd162743(VS.85).aspx

*BUT*...you cannot simply change the "background" color.  Instead, you have to handle ALL of the painting and tasks associated with the non-client area.  This means you must draw the background, title, and the all the buttons.  Additionally, you must handle the mouse interaction messages, the non-client area "hit-testing", so the user gets feedback from the buttons you've drawn and the operating system knows when the mouse is over your buttons, the title bar, or the edges of the form:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms645601(v=vs.85).aspx#_win32_Nonclient_Area_Mouse_Messages

There are other nuances to consider.  This article is a good place to start:
http://geekswithblogs.net/kobush/articles/CustomBorderForms.aspx
http://geekswithblogs.net/kobush/articles/CustomBorderForms2.aspx

To summarize, it's possible but carries a lot of baggage with it.
0
 
IssacJonesAuthor Commented:
Cheers. I had suspected but needed confirmation.
0
 
Carlos VillegasFull Stack .NET DeveloperCommented:
Hello @Idle_Mind, you're right, I started my answer in a wrong way, but at the end I said:
or, you will need to rely on your own window border implementation.
but as you already said, this requires a lot of work.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now