MFC: Draw shape (circle) that user can drag and place

I need to make small shapes that any user that runs the progam can mov

Page 1 of 1

6 Replies - 9671 Views - Last Post: 26 February 2009 - 09:54 AM Rate Topic: -----

#1 essencedivine   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 20-February 09

MFC: Draw shape (circle) that user can drag and place

Posted 20 February 2009 - 12:24 PM

I need to make small shapes that the program user can move around and place anywhere at will during runtime using the mouse! User clicks on the shape e.g circle and then is able to move/drag it around. The shapes should have properties like name, radius, location etc so that if user moves the circle around, its location property is updated automatically. What is the best/easiest way to achieve this? I know how to make these shapes. We can use ellipse function in MFC but that shape is non-responsive to the mouse. I want to learn how to make user be able to interact with it at runtime.
MFC (preferably) or C# help is required please. Thanks.

Is This A Good Question/Topic? 0
  • +

Replies To: MFC: Draw shape (circle) that user can drag and place

#2 Hyper   User is offline

  • Banned

Reputation: 108
  • View blog
  • Posts: 2,129
  • Joined: 15-October 08

Re: MFC: Draw shape (circle) that user can drag and place

Posted 20 February 2009 - 12:27 PM

Track the mouse. If the mouse is on the shape's X, Y, and the left mouse button (or right) is down, change the X, Y of the shape to match that of the X, Y of the mouse.
Was This Post Helpful? 1

#3 pr4y   User is offline

  • Location: 127.0.0.1
  • member icon

Reputation: 35
  • View blog
  • Posts: 621
  • Joined: 19-September 08

Re: MFC: Draw shape (circle) that user can drag and place

Posted 20 February 2009 - 12:35 PM

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Post your code like this: :code:

Thanks :)
Was This Post Helpful? 0
  • +
  • -

#4 essencedivine   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 20-February 09

Re: MFC: Draw shape (circle) that user can drag and place

Posted 22 February 2009 - 02:03 PM

View PostHyper, on 20 Feb, 2009 - 11:27 AM, said:

Track the mouse. If the mouse is on the shape's X, Y, and the left mouse button (or right) is down, change the X, Y of the shape to match that of the X, Y of the mouse.


Thanks for the reply! I'm wondering if I could use activex objects? Can I for this particular problem? I haven't programmed activex before. Are they right for the job? Can I use them here? And any advice where I could learn how to do it? Any tutorial link or book etc (that is if activex is right for this problem--can anybody plz tell me in summary what activex objects are used for)? Thanks!
Was This Post Helpful? 0
  • +
  • -

#5 essencedivine   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 20-February 09

Re: MFC: Draw shape (circle) that user can drag and place

Posted 24 February 2009 - 02:49 PM

View Postpr4y, on 20 Feb, 2009 - 11:35 AM, said:

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Post your code like this: :code:

Thanks :)


I hope I'm not offending you Sir, but I'm asking this question in good faith! I don't want anybody to provide me with any code. I just want guidance on how to solve a problem in the best way. I don't even want a detailed line-by-line description. Only a simple direction. I'll write all the code for it myself, God willing. So please, help me with my problem everybody!!!

So,
1) Can I use activeX for this particular problem?
2) Any good links for learning it?
3) And in summary, what does activeX do?
Was This Post Helpful? 0
  • +
  • -

#6 jeff666   User is offline

  • D.I.C Head

Reputation: 6
  • View blog
  • Posts: 193
  • Joined: 30-December 08

Re: MFC: Draw shape (circle) that user can drag and place

Posted 25 February 2009 - 03:28 AM

It's a Win32 FAQ
See on Win32 api Group
for the classic sample.
Was This Post Helpful? 0
  • +
  • -

#7 Hyper   User is offline

  • Banned

Reputation: 108
  • View blog
  • Posts: 2,129
  • Joined: 15-October 08

Re: MFC: Draw shape (circle) that user can drag and place

Posted 26 February 2009 - 09:54 AM

I wouldn't know about ActiveX Controls.

Hope you find an answer, sorry for the late reply. I don't use MFC FYI.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1