开发者

Will a pre-defined Brush follow changes in Windows color scheme?

开发者 https://www.devze.com 2023-02-27 05:45 出处:网络
Let\'s say I have the following code: Dim _Brush_Disabled As New SolidBrush(Color.FromKnownC开发者_如何学Color(KnownColor.GrayText))

Let's say I have the following code:

  Dim _Brush_Disabled As New SolidBrush(Color.FromKnownC开发者_如何学Color(KnownColor.GrayText))
  Dim _Brush_Enabled As New SolidBrush(Color.FromKnownColor(KnownColor.WindowText))

  Sub Do_Something()
    '
    ' ... _Brush_Disabled and _Brush_Enabled are repeatedly used in this sub
    '
  End Sub

Will _Brush_Disabled and _Brush_Enabled automatically change their colors if the Windows color scheme changes?

If not, how can I make them 'track' Windows color scheme changes?


No, it won't automatically update for you. You can listen for the WM_SYSCOLORCHANGE event on your main window (or where ever your brushes are defined) to know when to update.

More information can be found here and here.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号