How do I change the style of a disabled control?

后端 未结 2 1384
野趣味
野趣味 2021-01-19 19:18

When a WinForm element is disabled, it sort of grays out. Is it possible to disable an element, but adjust the disabled style so it still looks enabled (not grayed out)?

2条回答
  •  日久生厌
    2021-01-19 19:58

    The disabled style is part of standard Windows behavior. If you want to change the style, you'll have to draw the control yourself, meaning that you'll have to handle the Paint method, and possibly have to override OnPaint.

    See Overriding the OnPaint Method and Custom Control Painting and Rendering.

提交回复
热议问题