msoft
asked on
How to draw filled boxes on dialog.
== working with VC++ 6. ==
I need to draw an array of filled boxes on a dialog (each one should have its own color).
Those boxes should be "on top" of every control on this dialog.
Example would be thankful.
Michael.
I need to draw an array of filled boxes on a dialog (each one should have its own color).
Those boxes should be "on top" of every control on this dialog.
Example would be thankful.
Michael.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
PS: Please send me an example/ details of how should I do it.
thanks.
thanks.
I really can't there are too many details. You need to create a window of a new class. Do you know how to do that?
ASKER
please post as much as you can
thanks.
thanks.
Its better if I only post what you need!
Do you know how to create a new window class?
You will need to register a window class using RegisterClass. For this case you probably want to fill in the WNDCLASS so that the background brush is NULL. You'll probalby want something like
WNDCLASS WndCls = {0,WndPrc,0,0,InsHnd,NULL, NULL,NULL, NULL,"Clas sName"};
RegisterClass(&WndCls);
You will need to write a window procedure. The procedure should be pretty simple. It will probably call the default window procedure for all messages except the WM_PAINT message. You will have to paint the window in that message. How, you paint it I can't say as I don't know what it is supposed to look like.
LRESULT WndPrc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
switch(uMsg)
{
case WM_PAINT:
{
PAINTSTRUCT Ps;
HDC DCHnd = BeginPaint(hwnd,&Ps);
RECT ClpRec;
GetClipBox(DCHnd,&ClpRec);
FillRect(DCHnd,&ClpRec,Get StockObjec t(BLACK_BR USH));
EndPaint(hwnd,&Ps)
}
default:
return DefWindowProc(hwnd,uMsg,wP aram,lPara m);
}
}
Do you know how to create a new window class?
You will need to register a window class using RegisterClass. For this case you probably want to fill in the WNDCLASS so that the background brush is NULL. You'll probalby want something like
WNDCLASS WndCls = {0,WndPrc,0,0,InsHnd,NULL,
RegisterClass(&WndCls);
You will need to write a window procedure. The procedure should be pretty simple. It will probably call the default window procedure for all messages except the WM_PAINT message. You will have to paint the window in that message. How, you paint it I can't say as I don't know what it is supposed to look like.
LRESULT WndPrc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
switch(uMsg)
{
case WM_PAINT:
{
PAINTSTRUCT Ps;
HDC DCHnd = BeginPaint(hwnd,&Ps);
RECT ClpRec;
GetClipBox(DCHnd,&ClpRec);
FillRect(DCHnd,&ClpRec,Get
EndPaint(hwnd,&Ps)
}
default:
return DefWindowProc(hwnd,uMsg,wP
}
}
ASKER
I want to define an object using Grid control.
Object is defined by 2 Colors and about 20 other parameters.
I`m using Sheridan Grid Control that has checkbox,listbox etc. bind into the grid
but is is not possible to set color of individual cell
so I want to add a functionality of setting color using this grid.
I mean that on top of this Grid I`ll draw colorful rectangles and when user clicks on it I`ll show Color Dialog Box.
Thanks.