Author Topic: Bitmap button example with reusable code.  (Read 272 times)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 6868
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Bitmap button example with reusable code.
« on: November 18, 2019, 09:56:20 PM »
I went through some of my pre 2000 heirlooms and found this one which was not that hard to modernise, the virtue of using pure API code. It is a working example of a control that takes 2 bitmaps, an UP and a DOWN image. To reuse the code you need to copy 2 procedures, "BmpButton" and "ButnProc".

You create the control(s) with the following code as per the example.

        BmpButton hInstance,hWin,30,30,250,251,500
        BmpButton hInstance,hWin,30,100,252,253,501

You create two bitmaps of the same size for the UP and DOWN positions, tested on 16 colour and RGBA colour . Each button is located by its top  X & Y and the button size is determined by the bitmap size. The trailing argument is the button ID for WM_COMMAND processing.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy: