From: Bob S on 18 Mar 2010 16:52 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. -- Robert E. Styma Principal Engineer (DMTS) Alcatel-Lucent, Phoenix
From: OmegaSquared on 19 Mar 2010 00:32 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
From: Jarek Mielcarek on 19 Mar 2010 02:47 W dniu 2010-03-18 21:52, Bob S pisze: > 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. Try this: http://www.codeproject.com/KB/miscctrl/TheoryOfMoveableObjects.aspx Jarek
From: Andrew Morton on 19 Mar 2010 05:00 Bob S wrote: > 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. The keyword you're looking for is probably "sprites": http://www.google.com/#hl=en&source=hp&q=vb.net+sprites Andrew
From: Chris Dunaway on 19 Mar 2010 13:38
On Mar 18, 3:52 pm, Bob S <B...(a)discussions.microsoft.com> wrote: > 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. > > -- > Robert E. Styma > Principal Engineer (DMTS) > Alcatel-Lucent, Phoenix Try this: http://www.bobpowell.net/manipulate_graphics.htm Chris |