home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_demos / multipic / multipic.txt < prev    next >
Text File  |  1992-01-19  |  2KB  |  47 lines

  1.  
  2. 1/19/92 - Mark Gamber
  3.  
  4.    MULTIPIC is an example of how to apply a number of bitmaps or icons to what
  5. appears to be a single picture button. As is evidenced by looking at the form,
  6. there are several buttons but only 3 different "types", each type consisting of
  7. a general theme. For example, there is an "Exit" button, a down arrow and a
  8. mouse. The "Exit" and Down Arrow buttons only go up or down. Therefore, three
  9. buttons are required to implement the effect. To create the "Exit" button,
  10. make one picture button and, using Copy and Paste, make two more of the same
  11. button. ALWAYS COPY FROM THE ORIGINAL BUTTON, NOT FROM A COPY! Next, set the
  12. BorderStyle to None and set the pictures. Use a default picture, in the case
  13. of "Exit" it is the "up" position bitmap of the button, and apply it to the
  14. original copy of the button. Now apply the "up" again to a copy and the "down"
  15. to another copy. Set the copies Visible to FALSE.
  16.    In this case, the "down" bitmaps are in array number two, so when the mouse
  17. is pressed, apply array two to array zero like so:
  18.  
  19.    Picture1(0).Picture = Picture1(2).Picture
  20.  
  21. When the mouse is released, put back the original bitmap thus:
  22.  
  23.    Picture1(0).Picture = Picture1(1).Picture
  24.  
  25. And you get a "pressed" 3-D effect. The "Down arrow" works the same way.
  26.  
  27.    The mouse button has an extra picture since you can press the left or right
  28. mouse button. The extra, of course, is the right button down. So, when a button
  29. is pressed, your code might look like this:
  30.  
  31.    if Button = 1    ' Left button
  32.       Picture3(0).Picture = Picture3(2).Picture
  33.    else
  34.       Picture3(0).Picture = Picture3(3).Picture
  35.    end if
  36.  
  37. When the button is released, do the same thing as the "Exit" button:
  38.  
  39.    Picture3(0).Picture = Picture3(1).Picture
  40.  
  41.  
  42.    The advantage here is that you don't need to load the bitmaps and icons from
  43. disk. Since they are already attached to a button, they are part of the program
  44. itself.
  45.  
  46.  
  47.