?
Solved

image draw and select to move/rotate via mouse

Posted on 2006-04-09
6
Medium Priority
?
470 Views
Last Modified: 2010-04-24
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
0
Comment
Question by:yancija02
  • 3
  • 3
6 Comments
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 16415604
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
 

Author Comment

by:yancija02
ID: 16420110
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
 
LVL 45

Accepted Solution

by:
AndyAinscow earned 1500 total points
ID: 16420141
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
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 

Author Comment

by:yancija02
ID: 16422776
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
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 16423915
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
 

Author Comment

by:yancija02
ID: 16433283
Andy,

I am beginning to notice the complexity...

Thanks much for all your help.

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question