开发者

Winforms fixed single border on custom shaped control

开发者 https://www.devze.com 2022-12-30 15:03 出处:网络
I have created a custom control inheriting from a panel 开发者_如何学Cin .NET 3.5 The panel has a custom polygon border, which comes from a pointF array (In diagram, control is highlighted yellow).

I have created a custom control inheriting from a panel 开发者_如何学Cin .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 http://poseidon.toop.com.au/noBorder.PNG

Fig1


alt text http://poseidon.toop.com.au/withBorder.PNG

Fig2


I would do a transform on the points (zoom-in), then use Graphics.DrawPolygon(brush, points) using the transformed points, or you could do the inverse (fill in with black, then transform (zoom-in) and then draw again smaller with yellow.

0

精彩评论

暂无评论...
验证码 换一张
取 消