[RESOLVED] Set Brush color same as form background (Control)-VBForums
Results 1 to 3 of 3

Thread: [RESOLVED] Set Brush color same as form background (Control)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2013
    Posts
    68

    Resolved [RESOLVED] Set Brush color same as form background (Control)

    I need to set a brush color to the same as a form background which is currently set to Control.
    All I see is brushes.<some color> which doesn't have what I need.

  2. #2
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,289

    Re: Set Brush color same as form background (Control)

    You have to go in a little bit of a circle to do that.

    Control is a "system color" because there are system settings the user can change that define what color it is. It has a default we're all used to, but that it can change means you can't use a constant color like "grey" even if 99% of people use grey.

    If you need a system color, you use the SystemColors class instead of the Colors class. Likewise, if you need a system brush, you use the SystemBrushes class instead of Brushes.

    Code:
    Dim controlBrush As SolidBrush = SystemBrushes.Control
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2013
    Posts
    68

    Re: Set Brush color same as form background (Control)

    Quote Originally Posted by Sitten Spynne View Post
    You have to go in a little bit of a circle to do that.

    Control is a "system color" because there are system settings the user can change that define what color it is. It has a default we're all used to, but that it can change means you can't use a constant color like "grey" even if 99% of people use grey.

    If you need a system color, you use the SystemColors class instead of the Colors class. Likewise, if you need a system brush, you use the SystemBrushes class instead of Brushes.

    Code:
    Dim controlBrush As SolidBrush = SystemBrushes.Control
    That works just fine, thank you for that!

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.