Skip to content

Latest commit

 

History

History
11 lines (6 loc) · 1.14 KB

README.md

File metadata and controls

11 lines (6 loc) · 1.14 KB

TextBox Border Color

You can change border color of TextBox by overriding WndProc method and handling WM_NCPAINT message. This way you can draw on non-client area of the TextBox control.

To do so, get the window device context of the control using GetWindowDC. Then to draw, create a Graphics object from that context, then draw border for control.

You need to the control when assigning new BorderColor or when the size of control changes. To do so, you can use RedrawWindow method.

MyTextBox control has a BorderColor property. The control uses BorderColor if the property values is different than Color.Transparent and BorderStyle is its default value Fixed3d. To see the themed border color, set the BorderColor to Color.Transparent.

TextBoxBorderColor