-
August 13th, 2005, 10:29 AM
#1
Possible to Draw A Standard Control Into a DC?
Just wondering, is there a way to draw a standard control (such as a button, a group box, a radio button) into an arbitrary memory DC? In other words, if i call this certain API Windows will draw all the required visual appearance for that standard control into my provided device context. I could have sworn i saw an api that did this but i cant find it anymore
Thanks in advance
-
August 13th, 2005, 11:04 AM
#2
Re: Possible to Draw A Standard Control Into a DC?
yes you can do it, and the api is still live and kicking
DrawFrameControl(..)
Cheers
Last edited by golanshahar; August 13th, 2005 at 11:12 AM.
-
August 13th, 2005, 11:22 AM
#3
Re: Possible to Draw A Standard Control Into a DC?
Hi golanshahar, thanks for the quick reply. I did see this api but was a little concerned that it didnt have a feature to draw group boxes. Baffling as that may be. Can you tell me is there such an api that can draw group boxes too, as DrawFrameControl(..) seems to draw everything else but htat.
Thanks again
-
August 13th, 2005, 12:44 PM
#4
Re: Possible to Draw A Standard Control Into a DC?
well i dont know of other function however its pretty easy to draw it yourself here i made you a function that draw GroupBox ( just for you ) it looks the same i checked it out.
Code:
void DrawGroupBox ( HWND hWnd, const RECT &rc )
{
HDC dc = ::GetDC(hWnd);
HBRUSH hBrush = ::CreateSolidBrush(RGB(255,255,255));
::FrameRect(dc,&rc,hBrush);
RECT rcTmp = rc;
::InflateRect(&rcTmp,1,1);
::FrameRect(dc,&rcTmp,hBrush);
::DeleteObject(hBrush);
hBrush = ::CreateSolidBrush(RGB(128,128,128));
::InflateRect(&rcTmp,-1,-1);
rcTmp.top-=1;
rcTmp.left-=1;
::FrameRect(dc,&rcTmp,hBrush);
::DeleteObject(hBrush);
::ReleaseDC(hWnd, dc);
}
just send it the HWND of the window you want to draw it and the rect of the group box.
hope it helps.
Cheers
-
August 13th, 2005, 01:06 PM
#5
Re: Possible to Draw A Standard Control Into a DC?
hahaha thanks a lot golanshahar. Ill rate ya!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|