MFC Mouse puzzle
-
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
-
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
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.
-
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.
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
-
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