selecting object on the screen

Jul 9, 2013 at 10:58am
Pleas give me some idea about screen highlating using mouse.ie,When user dragging the mouse on screen,that much area of screen should be highlite,just like a paint application,picture selecting when dragging with mouse.what and all system function i have to use,& in which handler i should write the code.please help me
Jul 9, 2013 at 5:55pm
Do you mean working on whole screen (desktop) or inside your application's window only?
Last edited on Jul 10, 2013 at 1:15am
Jul 10, 2013 at 1:10am
If you're talking about your application's windows (you do say, like a paint app') then this example from Petzold's book Programming Windows might help.

BLOKOUT2.C -- Mouse Button & Capture Demo Program (c) Charles Petzold
http://www.charlespetzold.com/pw5/blokout2.c

The technique's called rubber-banding. It's one of the few occasions you do (a little bit of) drawing outside of the WM_PAINT handler.

By the way, Petzold's book would be well worth seeing if you want to get to grips with the foundations of Windows programming.

Andy

Also see the following MSDN entries for related information:

Using Rectangles
http://msdn.microsoft.com/en-us/library/windows/desktop/dd145184%28v=vs.85%29.aspx

Using Mouse Input
http://msdn.microsoft.com/en-us/library/windows/desktop/ms645602%28v=vs.85%29.aspx

(I did Google to see if there was anything else of use, but rubber banding is hard to look for. The key thing is that the basic GDI approach involves mouse moves and the SetROP2 command (see MSDN for details about it.) A more complicated approach is required if you use GDI+ instead or GDI.

How to draw a rubber band or focus rectangle in Visual C++ .NET or in Visual C++ 2005
http://support.microsoft.com/kb/816170 )
Last edited on Jul 10, 2013 at 1:50pm
Jul 10, 2013 at 6:51am
Thanks Andy.I tryed BLOCKOUT2.c n got it
Last edited on Jul 10, 2013 at 9:41am
Topic archived. No new replies allowed.