Changing colour of border around dialog

Posted on 2011-10-20
Last Modified: 2012-05-12

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.

Question by:IssacJones
    LVL 17

    Accepted Solution

    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.
    LVL 85

    Expert Comment

    by:Mike Tomlinson
    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* 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.

    Author Closing Comment

    Cheers. I had suspected but needed confirmation.
    LVL 17

    Expert Comment

    by:Carlos Villegas
    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
    Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    This video discusses moving either the default database or any database to a new volume.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now