?
Solved

Icon size on graphic buttons

Posted on 2000-02-28
4
Medium Priority
?
301 Views
Last Modified: 2013-11-19
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
Comment
Question by:Upland
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 32

Accepted Solution

by:
Erick37 earned 400 total points
ID: 2567090
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
 
LVL 4

Expert Comment

by:Jeremy_D
ID: 2568316
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
 

Author Comment

by:Upland
ID: 2569561
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
 
LVL 32

Expert Comment

by:Erick37
ID: 2570162
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many programs have tried to outwit PowerPoint in terms of technology and skill. These programs, however, still lack several characteristics that PowerPoint has possessed from the start. Here's why PowerPoint replacements won't entirely work for desi…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Learn how to create interesting presentations by including videos to keep your audience engaged using Prezi. Select "Insert" from the top menu in your Prezi editor: Select "YouTube Video": Paste the video URL into the prompt: "Select "Insert":…
Suggested Courses
Course of the Month13 days, 7 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question