Application Starting Point

C

Charlie Brown

Good day,
I have been tasked with a new application that needs to show a
graphical representation of boxes on a shelf. It needs to have the
ability to rearrange the boxes of different sizes by dragging and
dropping them into place. Basically an updateable diagram of many
racks which contain mutiple shelfs. Each shelf has X amount of space
and you need to be able to drag and drop "boxes" onto the shelf.

To the question: I am looking for ideas on a good way to go about this.
Would using .NET GDI be enough, or do I need to tap into a game
engine, DirectX, or even easier just create controls that can be moved
around on panels? How do you cpture mouse events to know when you are
dragging something, and how do you make and object essentially follow
the cursor as it is dragged? And finally, should I keep everything in a
game loop, like the ON_Paint event of the form, or somewhere else?

Thanks in advance for any thoughful comments!
 
K

Kevin Spencer

Hi Charlie,

I had a similar requirement, with a surface that had to display objects that
drew themselves and could be dragged and dropped. Unless you need true 3D
images, there's no need to use DirectX. You can create custom Controls that
will serve very nicely. An easy way to start is by inheriting
System.Windows.Forms.UserControl (see
http://msdn2.microsoft.com/en-us/library/system.windows.forms.usercontrol.aspx).
In my case, these Controls drew different types of things, and had
differences in behavior as well, so I created a base Control class, gave it
all of the common (e.g. dragging, dropping, selecting, etc) functionality,
and inherited that in a number of derived Control classes.

As for a loop, Windows Forms already run in a message loop, so there's no
need to do that.

--
HTH,

Kevin Spencer
Microsoft MVP
Software Composer
http://unclechutney.blogspot.com

If the Truth hurts, wear it.
 
C

Charlie Brown

Thanks for the info Kevin. I have been been expirimenting with your
suggestions and have a good working start. If I activate drag and drop
on the control, I can no longer drag my control around the form. Is
there anyway to enable drag and drop and still be able to actually move
the control vice having the cursor just change? I really just want the
drop notification to be heard when i place one control on top of
another.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top