• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 311
  • Last Modified:

Icon size on graphic buttons

Ok... I have an application in VB5 which has several command buttons all with graphics - and no text.  The graphics are icons to get the invisible background. They are all created at 48x48 pixels. The compiled exe runs fine on about 6 different machines yet on one particular Win95 machine the application displays the icons at 32x32 pixels... ie it shrunk them down and they look terrible. They consequently only fill 75% of the button. I have tried creating icons of different colour depth (24bit, 16bit, even 256 colour). I have also tried other screen res setting (800x600, 1024x768 etc).

I have also tried machines running NT4. Some with and some without Plus Pack.

Even so... this one machine (Toshiba incidently) refuses to display my icons at the original 48x48 pixels.  Even WinZip displays icon buttons correctly at 48x48. What am I doing wrong with the VB?

0
Upland
Asked:
Upland
  • 2
1 Solution
 
Erick37Commented:
Use a 48x48 bitmap (bmp) image instead of an icon.
Set the Command button's MaskColor property to the color you want to be transparent in your bitmap, and set the UseMaskColor property True.
0
 
Jeremy_DCommented:
Be sure to check the size of the buttons too. If you set them to 780 (52x15) twips, that will display correctly on most systems, but some graphics chips use another ratio (like the new intel 810 motherboard with on-board graphics chip).

The icon is in pixels, so that is a constant, but the button should be set to a size of 52 x TwipsPerPixelX width and 52 x TwipsPerPixelY height (52 in stead of 48 to accomodate for the 2 pixel width borders of the command button) programmatically to allow correct display on systems with differen twips/pixel ratios. Alternatively, you can set the form's scalemode to Pixels in stead of Twips and make the buttons a width and height of 52.

0
 
UplandAuthor Commented:
Thank you.... works a treat! I've learned something new.  

By the way, is this the way in which WinZip (for example) can display buttons which are disabled and the displayed graphic is in the windows system colours? I'll have a play.

Thanks again
0
 
Erick37Commented:
The Command Button can also have a DownPicture and DisabledPicture assigned to it.  You must create a separate bitmap for each of these images if you use them.

There is the DrawState() API call which can take one bitmap, and generate a "disabled look" bitmap from it at runtime.  This effect is used in the toolbar of VB's IDE for example.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now