PRODUCT : Borland C++ NUMBER : 1534 VERSION : 3.x OS : WIN DATE : October 25, 1993 PAGE : 1/3 TITLE : How to create custom bitmaps for buttons Many people call in asking how to put a Bitmap on a dialog button. This is a very simple process and I will explain the steps to follow. I am assuming you already know how to use the Resource Workshop and how to create a Bitmap and buttons in a dialog. You just need to know how to put the two together. 1. Load the Resource Workshop, open the File menu and select New Project. Select .RES or .RC as the Project file type and click OK. Next select New from the Resource menu, this will allow you to pick the type of resource to create. Highlight BITMAP and click OK. 2. Now you are at the New Bitmap attributes dialog and need to enter the size of the Bitmap in pixels. The size needs to match the size of the button you plan to create. For this example leave the defaults to 64x64. Next select the number of colors you plan to use. Keep in mind what you feel your target machines will be running. For this example pick whatever your machine can support and click OK. Note: You should refrain from selecting 256 colors, because it can cause color image problems depending on what item is currently in focus. For example if you have two Bitmaps with one using 256 shades of Blue, and another using 256 shades of red. If the red button is the current focus the blue button will turn red. This is a drastic case but you get the idea that you can run out of colors. So in the long run 16 colors is the safe choice. 3. Now you can paint your Bitmap. 4. In the Paint Editor, choose Resource|Rename to bring up the Rename dialog. The name should be the control ID of the button added to the Bitmap offset for the correct button state. The following chart contains the offsets for the different states and video environments. Offset for Offset for Button state VGA or higher EGA or Monochrome ------------------------------------------------------------- Standard 1000 2000 Pressed 3000 4000 Keyboard focus 5000 6000 PRODUCT : Borland C++ NUMBER : 1534 VERSION : 3.x OS : WIN DATE : October 25, 1993 PAGE : 2/3 TITLE : How to create custom bitmaps for buttons ------------------------------------------------------------- Let's say the control ID of your button is going to be 100 and you want a Bitmap for all three states of the button. You would create three Bitmap renamed to 1100, 3100, and 5100. For this example just create one Bitmap and rename it to 1100. Now close the Paint Editor window. 5. From select Resource|New highlight DIALOG and click OK to create a dialog for your Bitmap button. 6. You should be in the Dialog Editor with the Tools, dialog, Alignment, and Caption windows visible. We will be using the Tools and Dialog windows. If the Tools window is not visible check the Options and click Show Tools. 7. Next click and select the Borland Push button (which is in the fourth row, fourth column) and create a button in the Dialog window. 8. After clicking to create the button the cursor will change back to an arrow cursor, double click on the button you created. This will bring up the Borland Button style dialog box. In the Control ID field enter the ID number for the button. In our example that would be 100. Enter 100 and click OK, your Bitmap will now appear on the button. If your Bitmap does not appear check the Control ID of the button, it should be 100 for our example. Reopen the Bitmap and check the name you gave the Bitmap for our example it should be 1100. Last make sure you close the Paint Editor window. As long as the Bitmap name, Control ID, and Paint Editor window is closed this process will work. Once you have the example working go back and create two more Bitmaps and Rename one to 3100, and the other to 5100. Now add another item to your dialog and select Test on the Tool window. You will see your different Bitmaps appear according to the state of your button. It is also possible to change the bitmaps a Borland button uses at run time. This is done by sending the BBM_SETBITS message to the button. BBM_SETBITS is defined in bwcc.h, and documented in PRODUCT : Borland C++ NUMBER : 1534 VERSION : 3.x OS : WIN DATE : October 25, 1993 PAGE : 3/3 TITLE : How to create custom bitmaps for buttons the on line file bwccapi.rw. This file ships with the product, and is in the \borlandc\doc for Borland C++ users, or the tcw\doc directory for Turbo C++ for Windows users. Welcome to the world of Custom look buttons! DISCLAIMER: You have the right to use this technical information subject to the terms of the No-Nonsense License Statement that you received with the Borland product to which this information pertains.