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!

Question about displaying bitmaps

Status
Not open for further replies.

MarkDuane

Instructor
Jan 20, 2003
1
US
Hi !
I've come up with two problems with my application, which still remain
unresolved.
First off, I'd like to make a toolbar with more than 16-color bitmaps.
As a matter of
fact, CreateToolbarEx can't load other bitmaps, so my toolbar looks
ugly. Is there
another way to make a toolbar (like the one of Winzip) ? Now, a second
problem.
I've never managed to make a button with a bitmap on it. Here is my code
(in RAW
C) :

my_button = CreateWindow ("BUTTON",
"a caption",
WS_CHILD | WS_VISIBLE |
BS_OWNERDRAW,
50, 420,
80, 50,
hWnd,
(HMENU) MY_BUTTON,
hInst,
NULL);
hbmpMyBitmap = LoadBitmap(hInst, MAKEINTRESOURCE(MY_BMP));
hdc = GetDC(my_button);
hdcMemory = CreateCompatibleDC(hdc);
hbmpOld = SelectObject(hdcMemory, hbmpMyBitmap);
BitBlt(hdc, 0, 0, 48, 48, hdcMemory, 0, 0, SRCCOPY);
SelectObject(hdcMemory, hbmpOld);
DeleteDC(hdcMemory);
ReleaseDC(my_button, hdc);

It doesn't work at all, so I guess I haven't understood how the BitBlt's
worked.
Well, I would be very grateful if someone could help me with those
issues.
Thanks in advance,
Mark
 
Hello

If you goto they have short tutorials and example source code on how to do what you mentioned above. If you look down the leftside of the codeproject web page you should see a link to toolbars and another to buttons.

Good luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top