预定义的画笔是否会跟随Windows配色方案的变化?

时间:2011-04-21 02:19:19

标签: vb.net visual-studio-2010

假设我有以下代码:

  Dim _Brush_Disabled As New SolidBrush(Color.FromKnownColor(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

如果Windows配色方案发生变化,_Brush_Disabled_Brush_Enabled会自动更改颜色吗?

如果没有,我怎样才能让他们“跟踪”Windows配色方案的变化?

1 个答案:

答案 0 :(得分:2)

不,它不会自动为您更新。您可以在主窗口(或定义画笔的位置)监听WM_SYSCOLORCHANGE事件,以了解何时更新。

可以找到更多信息herehere