all groups > dotnet drawing api > december 2003 >
You're in the

dotnet drawing api

group:

Learning to place graphics


Learning to place graphics Gary Morris
12/30/2003 9:25:03 PM
dotnet drawing api:
Happy New Year!

Just recently, I tried my hand at some GDI+, starting
slowly, and I'm having some trouble now. I tried just a
few drawings in a window, and some other stuff, which
wasn't too hard, but now I'm wanting to create a program
that will allow me to:

1) Select a button from a toolbar.
2) Based on that button, allow me to move the mouse to
a section of the screen, or whatever control allows it,
3) Click the mouse and either place a specific object there
or START drawing an object from that spot.

I've been able to program the button to place an object on
the screen so far (a static spot), but I'm having trouble
trying to figure out the best way (well, ANY way for that
matter) to click that button and THEN move to a specific
area before actually "dropping" an object. The thing I'm
having the worst problem is how to schedule the event
properly. I am sure there are probably several, maybe
many even ways to do this, I just cannot get a good handle
on it.

I posted a similar message to .dotnet.csharp and was told
to hunt here.

Thanks

Re: Learning to place graphics Bob Powell [MVP]
12/31/2003 3:52:22 PM
You're talking about creating a retained mode graphics system.

Take a look at the GDI+ FAQ article entitled "How do I manipulate Graphics
on Screen" http://www.bobpowell.net/manipulate_graphics.htm

Well Formed also has an article in the August edition that explains how to
create drawing systems and handle the event order correctly.

--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

[quoted text, click to view]

Re: Learning to place graphics Gary Morris
1/3/2004 10:54:55 AM
Thanks, that helped a lot! I'm working with it a little at a time
so I can get acquainted with HOW it works and learn how to
write my own. I'll probably be back before long with questions
if I run into a wall, but so far I'm getting it. One thing that did
concern me though is the way that the demo constantly
repaints the form. I tried to run it in debug mode, but it was
tough to trace because just about anywhere I put a breakpoint
caused it to hang there until I cleared the break. It may be
that this is the only way to do it, it just seems awfully
resource expensive. Then again it IS just a demo, no?

[quoted text, click to view]

Re: Learning to place graphics Bob Powell [MVP]
1/3/2004 10:28:19 PM
Well, it is a demo yes. A demo of how to manage the event order, handle user
input, create an object model and work within the bounds of the system to
handle repainting and so-on. Most graphic applications do exactly the same
things, just more variations on the same theme.

Event driven systems are sometimes hard to debug because the program has to
be able to cope with just about any event at any time so unless you
understand why and when an event occurs you'll find it hard to envisage the
way that the program runs.

Resources aren't an ssue here. You'll find that the code uses resources
correctly by correct use of the Dispose method at the correct times.

--
Bob Powell [MVP]
C#, System.Drawing

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

[quoted text, click to view]

AddThis Social Bookmark Button