Creating a rectangle having rubber band effect filled with transparent color
- From: sujilsekhar@xxxxxxxxx
- Date: Thu, 3 Jul 2008 02:33:30 -0700 (PDT)
Hi All,
I have a requirement to draw a rectangle having rubber band effect. ie
when i click on one point of screen and starts dragging, a bounding
rectangle needs to be created and on dragging it should grow. Also i
need to fill this rectangle using a transparent color.
I am able to fill by using GDI+ as shown below in the code snippet.
Gdiplus::GdiplusStartup(&token, &gdiplusStartupInt, NULL);
Gdiplus::Graphics* pGraphics = new Gdiplus::Graphics(pDC-
GetSafeHdc());Gdiplus::SolidBrush* pOpaqueBrush = new Gdiplus::SolidBrush(50, 255,0,
0);
pGraphics->FillPolygon( pOpaqueBrush,
(Gdiplus::Point* )pPolygonPointArray,4);
I am facing one issue with this code set
I am calling this set of code on mouse move event.Since the call is
happening on mouse move for each mouse move a rectangle filled with
color red having a transparency value of 50 is drawn. Hence each
rectangle will be overdrawn by another rectangle thus making a
gradient effect from top corner to bottom corner.
I want to avoid this behaviour i.e. on each mouse move i want to clear
the old filling. I can't use Graphics::Clear() because of some
framework restriction i am using.
Can any one suggest any other way to acheive this.
Thanks in Advance.
Sujil C
.
- Follow-Ups:
- Prev by Date: Re: Gdi+ Bitmap/Image Clone() function
- Next by Date: Re: Gdi+ Bitmap/Image Clone() function
- Previous by thread: Re: Gdi+ Bitmap/Image Clone() function
- Next by thread: Re: Creating a rectangle having rubber band effect filled with transparent color
- Index(es):
Relevant Pages
|
Loading