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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Owner drawn/superclassed buttons

Status
Not open for further replies.

adorableMe

Programmer
Jul 10, 2002
1
DE
Hi

I'm new to the Windows API, I'm using CodeWarrior C++ so no visual stuff, and no MFC.

What I want to do is create buttons with transparently drawn images on them. The images will be provided at runtime so I can't use any kind of resources.

I mangaged to do this using CreateIconIndirect, but the function only seems to work for 16x16 or 32x32 images (not good enough for what I'm trying to do). Also the masking system for icons is really complicated - lots of bit-shifting and stuff which I'm not particularly good at.

So I decided it would be easier to create my own masking system, with an array of bytes set to True/False, and an array of RGB values for the bitmap.

Problem - how do I draw the image to a button? I have experimented with the SetPixel() function - it seems to be pretty slow. The pixels don't even appear at the same time.

One idea I had was to superclass the Windows button class, draw my image on the button then validate the region of the image before passing the paint message to the original button class. Would that work? And how would I make it so the whole image would appear at once, like an icon?

Thanks in advance. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top