-
"Skins" on windows
This question may encompass far more than I'm ready to handle, but I haven't found the answer elsewhere --
I'm creating an app that 1.) I don't want a title bar on, and 2.) I want my own custom skin that I create to be used rather than the default Windows look.
Could someone point me in the right direction on these two questions.
Thank you in advance,
exle
-
The "title bar" is added if you include WS_CAPTION style, (some of the other composite styles set this for you), browse the WS_settings and decide what you want.
To draw your own window frames etc., you need to intercept and process WM_NCxxxx messages - Non Client area messages. Look them up in the help.
-
also have a look at
WM_PAINT
CreateCompatibleDC()
CreateCompatibleBitmap()
SelectObject()
DeleteObject()
BitBlt()
and for the skin
CreatePatternBrush()
-
-
I got the regions/skins working with that tutorial (thanks) -
Now I have to figure out how to do child windows.. can anyone point me somewhere for this one?
My source code (very messy, its 5am) - www.rednax.net/c/bar.cpp, www.rednax.net/c/rednaxBar.exe
Thanks
exle
-
if you want to use bitmaps for the buttons, don't know if that's the idea:
hbmp=the HBITMAP of the BMP file or resource for the button in normal state
hbmp_pressed=the HBITMAP of the BMP file for the button in pressed state
so for every button, you need at least two bitmaps
Code:
LPDRAWITEMSTRUCT lpdis;
HDC hdc,hdcMem;
...
WM_CREATE:
...
hbutton = CreateWindow("button",NULL,WS_CHILD|WS_VISIBLE|BS_OWNERDRAW,0,0,0,0,hwnd,(HMENU)MYBUTTON,hinstance,NULL);
//also load the bitmaps here
...
case WM_DRAWITEM :
lpdis = (LPDRAWITEMSTRUCT) lParam;
hdcMem = CreateCompatibleDC(lpdis->hDC);
switch(lpdis->CtlID)//if the button is not pressed
{
case MYBUTTON:
SelectObject(hdcMem, hbmp);
StretchBlt(lpdis->hDC, lpdis->rcItem.left,lpdis->rcItem.top, lpdis->rcItem.right - lpdis->rcItem.left, lpdis->rcItem.bottom - lpdis->rcItem.top, hdcMem,0,0,mybuttonwidth,mybuttonheight,SRCCOPY);
break;
}
if(lpdis->itemState & ODS_SELECTED)//if the button is pressed
{
switch(lpdis->CtlID)
{
case MYBUTTON:
SelectObject(hdcMem, hbmp_pressed);
StretchBlt(lpdis->hDC, lpdis->rcItem.left,lpdis->rcItem.top, lpdis->rcItem.right - lpdis->rcItem.left, lpdis->rcItem.bottom - lpdis->rcItem.top, hdcMem,0, 0,mybuttonwidth,mybuttonheight,SRCCOPY);
break;
}
DeleteDC(hdcMem);
return 0;