|
![](/i/fill.gif) |
povray.org admin team <new### [at] DESPAMpovray org> wrote in article
<35d19bcc.69573461@news.povray.org>...
> >GUI Features:
> >
> >* A rectangle selection tool to easily set start_row, start_collumn,...
>
> If someone contributes some WinAPI C code that does rubberbanding in
> a window this will be added. Otherwise it won't ('cause we don't feel
> like reinventing the wheel).
>
Erm, you want something along the lines of :
When you get a WM_LBUTTONDOWN, do :
SetCapture(hwnd);
g_bDragging=TRUE; // g_bDragging is a globally defined boolean.
g_nEndXPos=g_nStartXPos=LOWORD(lParam);
g_nEndYPos=g_nStartYPos=LOWORD(lParam);
then during WM_MOUSEMOVE messages, do :
if(TRUE==g_bDragging)
{
hdc=GetDC(hwnd);
rop2=GetROP2(hdc);
SetRop2(hdc,R2_XORPEN);
Rectangle(hdc,g_nStartXPos,g_nStartYPos,g_nEndXPos,g_nEndYPos);
g_nEndXPos=LOWORD(lParam);
g_nEndYPos=LOWORD(lParam);
Rectangle(hdc,g_nStartXPos,g_nStartYPos,g_nEndXPos,g_nEndYPos);
SetRop2(hdc,rop2);
ReleaseDC(hwnd,hdc);
}
and, finally, on receiving a WM_LBUTTONUP, do :
if(TRUE==g_bDragging)
{
hdc=GetDC(hwnd);
rop2=GetROP2(hdc);
SetRop2(hdc,R2_XORPEN);
Rectangle(hdc,g_nStartXPos,g_nStartYPos,g_nEndXPos,g_nEndYPos);
SetRop2(hdc,rop2);
ReleaseDC(hwnd,hdc);
ReleaseCapture(hwnd);
g_bDragging=FALSE;
}
The coordinates of the selected rectangle will be stored in g_nStartXPos,
g_nStartYPos, g_nEndXPos and g_nEndYPos.
HTH,
--
Scott Hill
Sco### [at] DDLinks co uk
Software Engineer (and all round nice guy)
Company homepage : http://www.ddlinks.demon.co.uk
"The best trick the devil ever pulled was convincing people he didn't
exist..."
- Verbal Kint.
"the Internet is here so we can waste time talking about nothing in
particular when we should be working" - Marcus Hill.
Post a reply to this message
|
![](/i/fill.gif) |