I want to mimick drawing of default border based on value of property BorderStyle
.
Instead of single border around the control, my control is visualised as four adjacent custom-drawn boxes (2×2), each having standard border drawn individually. So for example, if Control.Border
is set to FixedSingle
value I want to draw single border around each box. Simplified example:
I have two related problems:
- using which standard method I can draw border from enumeration
System.Windows.Forms.BorderStyle
? - how do I determine pixel width of given border (e.g.
Fixed3D
) so I can use it in layout calculations?
If you want to get results that reliably look like the
BorderStyles
on the machine you should make use of the methods of theControlPaint
object.For testing let's do it ouside of a
Paint
event:On my machine this results in a screenshot similar to yours..:
..and these lines in the output: