Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using art as a window or control 1

Status
Not open for further replies.

Sypher2

Programmer
Oct 3, 2001
160
US
I would like to be able to draw a custom window or control (using a program like PhotoShop).

Is this possible and how would one go about doing it?
 
You can use PhotoShop to create a bitmap. Then load the bitmap into a resource. From then on you can use it for a button image, bltbit is onto a dialog for a background image, ....

Hope this helps.
 
for button:
create a .bmp from Photoshop
import as resource
HBITMAP hbmp;
//get the handle for the bitmap
hbitmap = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BITMAP1));
//Create a static popup with bitmap property
SPL = CreateWindowEx(WS_EX_TOPMOST,"STATIC", "", WS_BORDER | SS_BITMAP|WS_POPUP | SS_NOTIFY,x,y,0,0,hwnd,(HMENU)ID_BUTTON,hInstance,0);
SendMessage(SPL, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbitmap);//Set the bitmap to the static

The SS_NOTIFY will enable it so that in
WM_COMMAND:
{
switch(wParam)
{
case ID_BUTTON:{//do something
break;
}
break;
}
It basically makes it so you can add a function to it, when someone clicks on it, it'll do something (i.e. come up with a about dialog box).
Also on CreateWindowEx(WS_EX_TOPMOST | WS_EX_DLGMODALFRAME,...) creates it raised (like a button).
You also can do owner-drawn buttons

--------------
"Getting to the top is an extra reward.Its the climb that makes the man."
Xerxes Dynatos
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top