Winforms fixed single border on custom shaped control

Posted by JD on Stack Overflow See other posts from Stack Overflow or by JD
Published on 2010-05-19T05:46:09Z Indexed on 2010/05/19 5:50 UTC
Read the original article Hit count: 521

Filed under:
|
|
|
|

Hi all,

I have created a custom control inheriting from a panel in .NET 3.5

The panel has a custom polygon border, which comes from a pointF array (In diagram, control is highlighted yellow).

Fig 1 shows the control with BorderStyle none. Fig 2 with BorderStyle fixed-single

As shown in Fig 2, the border follows the Rectangle bounding the control. IS there a way to make the border follow the actual border of the control set by the polygon?

FYI the polygon is created using a GraphicsPath object.

Drawing the line with GDI+ does not work, as the control clips the line and it looks awful...

alt text

Fig1


alt text

Fig2

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#