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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top