Geometrics forms...

  • Thread starter Thread starter Steven
  • Start date Start date
S

Steven

Hi,

I have to draw a geometric form quite complex, like a car for example.
Then, i need to know which part of the car the user has clicked on.

In vb6 i would have used the "shapes" component to draw the car and then use
a mathemtical formula to test if the user is in or out of the car.

In C#, i don't see any componant to draw geometric forms at design time.
Is there any ?
Is there a best solution in C# ?

Thanks !
 
Steven said:
Hi,

I have to draw a geometric form quite complex, like a car for example.
Then, i need to know which part of the car the user has clicked on.

In vb6 i would have used the "shapes" component to draw the car and then use
a mathemtical formula to test if the user is in or out of the car.

In C#, i don't see any componant to draw geometric forms at design time.
Is there any ?
Is there a best solution in C# ?

I'd create user controls (or maybe only one for the whole car), override
OnPaint(..) and do the drawing myself. Most drawing functions are a
matter of calling _one_ function on the e.Graphics object, thus being
almost as simple as in VB6, yet much more flexible.

Also the GraphicsPath class contains a very useful function "IsVisible".
It checks if a Point is contained within a specified area. So you can
easily check if the mouse is over even very complex shapes, without
doing at math at all.

hth,
Max
 
Thanks for your answer but even if i understand quite well "the way to use"
graphic functions, i'm not sure to get how to draw the car.
Do you mean that i need to describe it by giving each point's coordinates in
the code ?

Is there any way to draw it directly with my mouse like with the paint
software of windows or like the Shapes componant in VB6 ?

Thanks again.
 
In my signature is a link to a commercial component that integrates in
Visual Studio .NET. It is much more than the Shapes component.

Regards,
Frank Hileman

check out VG.net: http://www.vgdotnet.com
Animated vector graphics system
Integrated Visual Studio .NET graphics editor
 
Back
Top