Darbio
Darbio

Reputation: 11418

Winforms fixed single border on custom shaped control

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 http://poseidon.toop.com.au/noBorder.PNG

Fig1


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

Fig2

Upvotes: 0

Views: 823

Answers (1)

user117499
user117499

Reputation:

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.

Upvotes: 1

Related Questions