Results 1 to 3 of 3

Thread: Any way to change border color for my form? (without screwing gloabally)

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2002
    Posts
    4

    Any way to change border color for my form? (without screwing gloabally)

    I want to change the color of the border on my vb form from (whatever windows color scheme currently being used).

    I wonder if there is a way to do it without having to use SetSysColor. Because that screws gloabally.

    'd also like to change the color of the scrollbars.
    - wonder -

  2. #2
    Fanatic Member Jerry Grant's Avatar
    Join Date
    Jul 2000
    Location
    Dorset, UK
    Posts
    810
    Not an easy thing to do!

    The short answer is No but as with all things in Windows there are other ways.

    1. Create a borderless window and put a bitmap window onto the form, then set up regions for the caption and caption buttons to emulate the form etc.

    2. Repaint the form using subclassing, using it's hDC, and API calls to replace the colours you want. This will have to be redone on form move, resize, create, repaint and scrollbar messages blah, blah........

    So, the Windows GDI motto is...... leave well alone.
    Jerry Grant................tnarG yrreJ
    Website: <JG-Design></.net>
    Email: [email protected]
    Working towards a bug free world......
    (Not a Microsoft employee)

  3. #3
    Frenzied Member MerrionComputin's Avatar
    Join Date
    Apr 2001
    Location
    Dublin, Ireland
    Posts
    1,616
    When any of the non client area of a window needs to be drawn, windows sends a WM_NCPAINT event to that window.

    In response to this message you can draw the non client area using any brush (and therefore any colour or colours) you require.

    However, it isn't straight forward and does require that you use subclassing...

    HTH,
    Duncan
    ----8<---------------------------------------
    NEW - The .NET printer queue monitor component
    ----8<---------------------------------------
    Now with Examples of use

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width