image draw and select to move/rotate via mouse

asked by yancija02 on 04/06/2006 12:59PM PDT  

The lowdown:  I'm creating a conference room diagram program for a software engineering class.  The user will click on a button, the image of an item (table, chair, what have you) will be generated within a panel, and the user will be able to select, move and rotate an object.  

What I don't know how to do:  Create a selectable object that can be moved and rotated within a panel via MOUSE click.  (I'd like to mimic the funtionality in Microsoft powerpoint as closely as possible)

I can draw these images just fine, and even rotate them, but it's all done programmatically and by myself in development.  I'm not sure how to extend this same ability to the user.

Any suggestions?  Is this sort of functionality that's built in, or is this going to take extensive coding?

Thanks,
Joe
yancija02Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
or is this going to take extensive coding?

If you can provide a method to save the image in the same form as you work with your images then you should be able to provide this functionality at not too much of coding expense.  (You save a 'chair', 'table'....)

Put another way.
If you have DrawChair(CDC* pDC, CRect *pRect), DrawTable(CDC* pDC, CRect *pRect) and so on with the details hard coded then it is likely to be a lot of work.
However if you could implement something like DrawGenericObject(CDC* pDC, CRect *pRect, CMyDrawObject* pOb) then it should be less work
0
yancija02Author Commented:
Andy,

Thanks for the comment.  I appreciate the feedback, and what you say makes sense, but I'm still not sure how to provide that move/rotate ability to an object after I've created it.  Any ideas on that?

Lets say for example that I've drawn a simple rectangle.  How do I go about allowing the user to select (click) it, and then perform actions to that specific rectangle, like dragging it to a new location.  It's really being able to select the item that has me hung up, I'm pretty sure I can figure out drag'n'drop/rotate once I know how to do that.

Thanks,
Joe
0
AndyAinscowFreelance programmer / ConsultantCommented:
You know where you draw it on screen.  Is the mouse click inside that object?  For a rectangle (along x,y  axes) you can use PtInRect.  (It gets more complicated when objects overlay one another / when you select a rotated object)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

yancija02Author Commented:
Andy,

Thanks, this might have been what I was looking for.  Give me a little to play with it before I close the question.  If you have any sample code suggestions, I'd appreciate it.  

-Joe
0
AndyAinscowFreelance programmer / ConsultantCommented:
I don't have any off the shelf code snippets - it is a complex task you are doing.  I suspect get the 'object' correctly coded (structure of data, drawing, load/save) and you have got a lot of the task conquered.

Also consider what happens if two objects overlap one another.
0
yancija02Author Commented:
Andy,

I am beginning to notice the complexity...

Thanks much for all your help.

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual C++.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.