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

Changing colour of border around dialog


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.

  • 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.
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):

*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:

There are other nuances to consider.  This article is a good place to start:

To summarize, it's possible but carries a lot of baggage with it.
IssacJonesAuthor Commented:
Cheers. I had suspected but needed confirmation.
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.

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