Groups | Blog | Home
all groups > dotnet drawing api > april 2004 >

dotnet drawing api : C#, Drawing place



Mathieu Chavoutier
4/28/2004 3:16:25 PM
Hi.

I would like to have a blank place with points every X pixels, where it
would be possible to draw/place components. A little bit like the GUI of VS.
I have to be able to draw a circle or wire between components.
And possibility of zoom.

Do you know anything that could be used for it?

Thanks.

Phil Price
5/25/2004 12:32:32 PM
Mathieu,

This is pretty generic problem you are asking. In a nutshell you need to:

- Create an object hierachy to contain the information you want drawn
o I suggest using an interface (e.g. IShape) over a set of object
(e.g. Ellipse, Line, star etc)
o Each Element should have a Render Method and some positional
information enforced by the Interface
o Create a strongly typed collection of the interface
o Add your custom objects to the collection
o call thier render method
- Capture on Paint event of a control (i suggest a picture box) and
render via the object hierachy described above
- Capture MouseDown, MouseMove, MouseUp and code up some funky stuff
to alow objects to be moved, edited (each object should have bounding
area you can check the mouse is in)

That should get you going.

--
Phil Price
CS BSc, University Of Hull
Microsoft Student Partner 2004
w: www.philprice.net

[quoted text, click to view]

AddThis Social Bookmark Button