Changing the shape of user control surface

  • Thread starter Thread starter Lorenzo
  • Start date Start date
L

Lorenzo

Hi,
I tried to create a user control with non rectangle shape, but i have
to specify
his size that it implies that i have to specify its width and its
height.
Result that when i click in the box of the control then click event
comes raised.
This is not good when the click is out the shape of the control but in
the box(its surface) that contain it.

Can i specify a different surface or i have to check the click
position?
Any suggestion is appreciated.
Thanks in advance.
 
Hi,
I tried to create a user control with non rectangle shape, but i have
to specify
his size that it implies that i have to specify its width and its
height.
Result that when i click in the box of the control then click event
comes raised.
This is not good when the click is out the shape of the control but in
the box(its surface) that contain it.

Can i specify a different surface or i have to check the click
position?
Any suggestion is appreciated.
Thanks in advance.

I solved.

I inserted
this snippet in OnPaint method of the user control

Dim gPath As GraphicsPath = New GraphicsPath()
gPath.AddPolygon(pts)
Me.Region = New Region(gPath)

where pts is an Point's array of the Polygon.
If there are other ways to solve it,
I'm opened to learn.
Bye
 
Back
Top