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
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
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
Re: Possible to Draw A Standard Control Into a DC?
well i dont know of other function :confused: 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
Re: Possible to Draw A Standard Control Into a DC?
hahaha thanks a lot golanshahar. Ill rate ya! :wave: :wave: