[comp.windows.ms] Bitmaps on pushbuttons

karel@prisma.cv.ruu.nl (Karel Zuiderveld) (09/28/90)

Quite a lot of Windows 3 programs are using bitmaps on pushbuttons
(eg. SETUP (F3 = door), various pushbuttons with the help program etc.).

In my copy of the (beta) SDK no functions can be found on doing tricks like
that and I also can't find no examples how to achieve this.

I'd really hate to reinvent the wheel. Is there anyone in netland willing
to mail me an example of how to achieve this?


Thanx!

Karel

-- 
Karel Zuiderveld                            E-mail: karel@cv.ruu.nl
3D Computer Vision - Room E.02.222          Tel:    (31-30) 506682/507772
Academisch Ziekenhuis Utrecht               Fax:    (31-30) 513399
Heidelberglaan 100, 3584 CX Utrecht, The Netherlands

risto@tuura.UUCP (Risto Lankinen) (10/01/90)

karel@prisma.cv.ruu.nl (Karel Zuiderveld) writes:

>Quite a lot of Windows 3 programs are using bitmaps on pushbuttons
>(eg. SETUP (F3 = door), various pushbuttons with the help program etc.).

>In my copy of the (beta) SDK no functions can be found on doing tricks like
>that and I also can't find no examples how to achieve this.

Hi!

If you're lucky enough, your beta-SDK includes a sample program 'Rainbow'.
It's an example of programming 'User-Defined controls'.  

There's also an article in one of the latest issues of Microsoft Systems
Journal (which I pity having forgotten the number of - check issues after
March '90).

In principle, you'll need to write a DLL which will support the control's
run-time functions (i.e. it's WinProc), a few functions used by DIALOG.EXE
when creating a dialog to use the control plus LibMain and WEP, which are
oblicatory (well, almost) for any DLL anyway.

Terveisin: Risto Lankinen
-- 
Risto Lankinen / product specialist ***************************************
Nokia Data Systems, Technology Dept *  2                              2   *
THIS SPACE INTENTIONALLY LEFT BLANK * 2 -1 is PRIME!  Now working on 2 +1 *
replies: risto@yj.data.nokia.fi     ***************************************

patrickd@chinet.chi.il.us (Patrick Deupree) (10/09/90)

In article <790@tuura.UUCP> risto@tuura.UUCP (Risto Lankinen) writes:
>In principle, you'll need to write a DLL which will support the control's
>run-time functions (i.e. it's WinProc), a few functions used by DIALOG.EXE
>when creating a dialog to use the control plus LibMain and WEP, which are
>oblicatory (well, almost) for any DLL anyway.

Actually, there's a MUCH easier way to create those neat buttons with the
bitmaps.  There is a button style (BS_OWNERDRAW I believe) that  will
cause a button to send a message (WM_DRAWITEM) to it's parent Window whenever
redrawing itself.  Along with the WM_DRAWITEM message comes a structure that
has various bits set to tell whether the button is down, checked, etc.  Using
this you can use the Paint program that comes with Windows, draw two buttom
images (one in down state, one in up state), and then merely do a StretchBlt
of that image in the client space of the button (also contained in the
WM_DRAWITEM structure).  It's pretty cool.

Patrick
-- 
"What's in a name?  That which we call a rose by any other name would smell
 as sweet."             William Shakespeare
Patrick Deupree ->	patrickd@chinet.chi.il.us   (708) 328-3800
(Please note there are both a patrick and a patrickd at this site)