Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. MFC Mouse puzzle

MFC Mouse puzzle

Scheduled Pinned Locked Moved C / C++ / MFC
c++questionhelp
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Paul Griffin
    wrote on last edited by
    #1

    Hi all i'm about to begin developing an application that requires me to draw an image on a either a form or a dialog box (if possible?). Basically the image will consist of a series of lines and basic shapes interconnected. What i would then like to be able to do is with the mouse click on individual lines and in doing so automatically change their properties e.g. say i clicked on a line it would change from green to red. Is this sort of functionality achievable. The issue i'd have from a conceptual point of view is how do you determine which line you have clicked on, if any, in the mouse button event handler??? If possible i'd like to be able to implement this in VC++ as i have very little VB experience. so to go back to my earlier question is it possible to draw lines shapes etc. on a dialog box? i've never tried anything like that before and unfortunately for this particular project the SDI or MDI app look would not be suitable! Any advice is appreciated!! Regards, Griff

    C N 2 Replies Last reply
    0
    • P Paul Griffin

      Hi all i'm about to begin developing an application that requires me to draw an image on a either a form or a dialog box (if possible?). Basically the image will consist of a series of lines and basic shapes interconnected. What i would then like to be able to do is with the mouse click on individual lines and in doing so automatically change their properties e.g. say i clicked on a line it would change from green to red. Is this sort of functionality achievable. The issue i'd have from a conceptual point of view is how do you determine which line you have clicked on, if any, in the mouse button event handler??? If possible i'd like to be able to implement this in VC++ as i have very little VB experience. so to go back to my earlier question is it possible to draw lines shapes etc. on a dialog box? i've never tried anything like that before and unfortunately for this particular project the SDI or MDI app look would not be suitable! Any advice is appreciated!! Regards, Griff

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      Paul Griffin wrote: is it possible to draw lines shapes etc. on a dialog box? of course. do it in the OnPaint function. Paul Griffin wrote: do you determine which line you have clicked on, if any, in the mouse button event handler??? in your OnLButtonDown handler, you'll need to run through your list of line/shape objects and determine which, if any, of these objects contain the point-of-click. if there are multiple objects, you'll have to figure out a scheme for picking just one (Z-order). -c


      When history comes, it always takes you by surprise.

      Bobber!

      P 1 Reply Last reply
      0
      • C Chris Losinger

        Paul Griffin wrote: is it possible to draw lines shapes etc. on a dialog box? of course. do it in the OnPaint function. Paul Griffin wrote: do you determine which line you have clicked on, if any, in the mouse button event handler??? in your OnLButtonDown handler, you'll need to run through your list of line/shape objects and determine which, if any, of these objects contain the point-of-click. if there are multiple objects, you'll have to figure out a scheme for picking just one (Z-order). -c


        When history comes, it always takes you by surprise.

        Bobber!

        P Offline
        P Offline
        Paul Griffin
        wrote on last edited by
        #3

        Hey Chris thanks for the quick reply ... sorry if that question about drawing on dialog boxes seemed stupid ... but i have very little MFC experience and even less with drawing with MFCs I think i get what your saying though take the co-ordinates returned from the OnLButtonDown handler and match them against co-ordinates in the list of shapes .. seems blatantly obvious when someone points it out to you. thanks again!! Griff

        1 Reply Last reply
        0
        • P Paul Griffin

          Hi all i'm about to begin developing an application that requires me to draw an image on a either a form or a dialog box (if possible?). Basically the image will consist of a series of lines and basic shapes interconnected. What i would then like to be able to do is with the mouse click on individual lines and in doing so automatically change their properties e.g. say i clicked on a line it would change from green to red. Is this sort of functionality achievable. The issue i'd have from a conceptual point of view is how do you determine which line you have clicked on, if any, in the mouse button event handler??? If possible i'd like to be able to implement this in VC++ as i have very little VB experience. so to go back to my earlier question is it possible to draw lines shapes etc. on a dialog box? i've never tried anything like that before and unfortunately for this particular project the SDI or MDI app look would not be suitable! Any advice is appreciated!! Regards, Griff

          N Offline
          N Offline
          NormDroid
          wrote on last edited by
          #4

          Take a look at DrawCli MFC Sample.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups