Moveable Graphic Object? tutorials

  • Thread starter Thread starter Bob S
  • Start date Start date
B

Bob S

I am looking at a project which will require me to venture into some
new territory. I have been searching the net and appear to have not
hit on the correct keywords to find what I am looking for.

I need to write an application which draws objects on a canvas, but I need
the objects to remain objects so they could be moved around. Basically the
same sort of functionality found in Visual Studio Design mode where I can
pull a button out of the toolbox and after it has been placed, move it to
somewhere else.

Looking at the generated code, I see how buttons are created and positioned
and I suppose that trapping mouse down on the button and then looking at
motion events could allow me to move the object around. I suspect that there
is
support for doing that somewhere, but I have not found the correct set of
keywords to hit on it. Most of the stuff I have found on GDI objects and
graphics objects have dealt which drawing things on a canvas and then
"there they are there they stay".

Any pointers on where to look would be appreciated.

If I have not provided enough detail on what I am attempting to accomplish,
this application will be simliar to a gant chart program. The data objects
will
be generated from data with size being related to duration and coloration
being
related to the type of activity. These objects will be moved to one or more
timelines. Assorted cross checking will be done when the object is placed.
Snap to grid type granularity would also be nice.

Thank you for your time.
 
Hello, Bob,

I don't know about a tutorial for doing this, but when I had a somewhat
similar requirement I created custom controls for the movable objects and
placed them on a windows form (that I called a "drawing"). Then moving them
around was "just" a question of using/handling the standard Windows
click-and-drag methods. (I also added the capability to move the objects
with the keyboard. Again, just handling the keyboard events was "all" that
was required.)

(I've added the quotes, because "just" and "all" turned out to be a fair bit
of effort in itself. Maybe there are third-party tools that would make the
whole thing easier, but my constraints prevented use of third-part tools and
controls, so I didn't research this possibility.)

Cheers,
Randy
 
I am looking at a project which will require me to venture into some
new territory. I have been searching the net and appear to have not
hit on the correct keywords to find what I am looking for.

I need to write an application which draws objects on a canvas, but I need
the objects to remain objects so they could be moved around. Basically the
same sort of functionality found in Visual Studio Design mode where I can
pull a button out of the toolbox and after it has been placed, move it to
somewhere else.

Looking at the generated code, I see how buttons are created and positioned
and I suppose that trapping mouse down on the button and then looking at
motion events could allow me to move the object around. I suspect that there
is
support for doing that somewhere, but I have not found the correct set of
keywords to hit on it. Most of the stuff I have found on GDI objects and
graphics objects have dealt which drawing things on a canvas and then
"there they are there they stay".

Any pointers on where to look would be appreciated.

If I have not provided enough detail on what I am attempting to accomplish,
this application will be simliar to a gant chart program. The data objects
will
be generated from data with size being related to duration and coloration
being
related to the type of activity. These objects will be moved to one or more
timelines. Assorted cross checking will be done when the object is placed.
Snap to grid type granularity would also be nice.

Thank you for your time.

Try this:

http://www.bobpowell.net/manipulate_graphics.htm

Chris
 
I am looking at a project which will require me to venture into some
new territory. I have been searching the net and appear to have not
hit on the correct keywords to find what I am looking for.

I need to write an application which draws objects on a canvas, but I need
the objects to remain objects so they could be moved around. Basically the
same sort of functionality found in Visual Studio Design mode where I can
pull a button out of the toolbox and after it has been placed, move it to
somewhere else.

Looking at the generated code, I see how buttons are created and positioned
and I suppose that trapping mouse down on the button and then looking at
motion events could allow me to move the object around. I suspect that there
is
support for doing that somewhere, but I have not found the correct set of
keywords to hit on it. Most of the stuff I have found on GDI objects and
graphics objects have dealt which drawing things on a canvas and then
"there they are there they stay".

Any pointers on where to look would be appreciated.

If I have not provided enough detail on what I am attempting to accomplish,
this application will be simliar to a gant chart program. The data objects
will
be generated from data with size being related to duration and coloration
being
related to the type of activity. These objects will be moved to one or more
timelines. Assorted cross checking will be done when the object is placed.
Snap to grid type granularity would also be nice.

Thank you for your time.

Chris pointed you to an article that explained a bit about creating your own
retained mode graphics system around GDI/GDI+.

Might I point out though, that WPF already is a retained mode graphics system?
Hittesting, etc, etc, already built in... Just another alternative.
 
Back
Top