Command button, graphical with image and text...

Hi,
I have command buttons set to graphical with images and text captions.

My problem is that on different versions of Windows, or perhaps based on display settings, the captions appear differently than on other systems, and mostly for the worse....

Captions get cut off and are not visible... words get mangled...  if I have a caption on a button that says "Here is a label" then on some machines it might appear only as "e is a label"  where part of the start is cutoff.

In some cases blank spaces are added to the Caption to move the text to the right of the graphical image....

Has anyone seen this issue or know how to correct it?  Or even how to test it.

Regards,
-Tim
torrid333Asked:
Who is Participating?
 
aelatikConnect With a Mentor Commented:
You could try selecting a font for the command button instead of using the system font. that way you're not dependant of the users system font settings.
Thats the only thing i can think off that could be causing the problem.
0
 
torrid333Author Commented:
What font and size would I set it to that would maximize the compatibility on displays?
0
 
aelatikCommented:
OK, forget the font size. I just tested it and the system font changes don't apply to the command buttons. :-(
What you could check is to see if the used font exist on the machine's where the problem resides.

If the font does not exist it will use another font as substitute what could be causing the problem also.
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
torrid333Author Commented:
The comman buttons are specifying font as MS Sans serif  with size 8 pt.

I have not been able to reproduce this on my own computers... but several users have reported the issue... I suppose I can either 1). ask them to see if that font is installed or 2). add that font to our installer and install it if its not there.
0
 
aelatikCommented:
torrid333,

It is a very weird problem you have here. I think the best thing you can do is to wait and see if other experts respond to your question ( with their experience in this matter ). BTW, you're not using a third party command button aren't you ?
0
 
torrid333Author Commented:
No.  Not using 3rd party command button.  Am contemplating trying out a 3rd party code for it since mine is not working.... but if its a font issue I don't want to go to that trouble.
0
 
Hornet241Commented:
This may not be the best way but you could edit the graphics and add the caption to the pictures.
0
 
dbrckoviCommented:
Hi!

I had the same problem but I also didn't find the source. Both machines were Win2000/SP3 with the same settings (language, locales, keyboard layout, etc.) but graphical buttons
were messed up on one and perfect on another.

My sollution was to make buttons slightly larger than required.
Another possibility was to completely remove the caption from buttons and use the ToolTipText property instead.

I generaly wouldn't suggest "burning" any text in pictures or icons becouse this way you loose flexibility.
For example if some day you choose to add multi language support (let's say 5 languages) to your application, you'd have to create 5 slightly different sets of icons.
0
 
_agj_Commented:
change the text alignment for the button to left.
0
 
suramsureshbabuCommented:
can you change the display properties of the desktop and try to check. it might be the reason of the behaviour
0
 
KarcOriginCommented:
I am considering that almost the things are same at your's and other client machine I mean service packs, version, and others...

Now try this:

Private Sub Form_Load()

    Dim strCmdCaption As String
    strCmdCaption = "Here is a label"
   
    With Command1
        .Width = Me.TextWidth(strCmdCaption) + 500
        .Caption = strCmdCaption
    End With

End Sub

Here I have added 500 which is just to be sure for little extra width. This ensure that the caption will be totally visible to the user. The width will be expanded from the current Left position of the button.

Cheers!
0
 
EDDYKTCommented:
Have you tried to use true type font such as arial since MS Sans serif  is not


also search the resize form on this site. Ususally if you resize the form, the font should be adjust by that (as long as you use true type font)
0
 
mlmccCommented:
Are video resoultions the same?  Are the using small, large, custom fonts for the video?

Right click on the desktop
Click PROPERTIES
Click the SETTINGS tab
Click ADVANCED
Check the display FONT SIZE dropdown

mlmcc
0
 
torrid333Author Commented:
I dont see a text alignment property.  Ideally for my buttons they would be aligned "right".

No have not tried Arial fonts but that might be a possibilty.  Will have to do some testing there.

I may end up using a 3rd party button control.  has anyone used one?  Which one?  Did it work for you?

Also, I tried using button type Graphical and setting the picture as an icon i'm using...  It puts picture at top then text underneath.  I want picture on left and text on right similar to HTML page where you do align=left on an image on a web page....  Anyone know how to do that?
0
 
KarcOriginConnect With a Mentor Commented:
Hi,
With default button with visual basic it is not possible. Try this: Place a picture box on your button, and than place a label inside that picture box. By this you can place your text any where you want. Moreover your font problem may also be solved. If in any case you want to end up with 3rd party controls there are many in one project I used Crescent controls (Or Quickpak controls).

Cheers!
0
 
softpro2kCommented:

Hornet241 - you are right. That is the most logical solution.

0
 
torrid333Author Commented:
I think my problem is that we are indeed putting a picture box over the button... but instead of adding text label we  used the default caption on the underlying button and used spaces to pad out the caption to make it align the way we like... the problem is that on different displays that gets hosed up... the other thing is we added a "resize" control that resizes our form automagically and the picture box in some cases has a white background instead of blending with the button....

Anyway, would you recommend the picture box and label or a 3rd party control?  i have to make a decision this week and get this thing rolled out....  both solutions are mentioned.

0
 
torrid333Author Commented:
If you try to put a label on top of the command button it does not work.  You cannot get the Order to move it in front of the button...  I'm going to try using the picture box next and seeing if that helps.
0
 
KarcOriginCommented:
Hmmm... I think you better try to use the picture box and see if you get that you want as I mention it in my previous comment(s)

Thanks and good luck.
0
 
torrid333Author Commented:
If I put an icon in the picture box... then widen the picture box and add a label for text.  Then it starts out beautifully.
But I have an "auto resize" control that resizes all of the picture box controls on load... and I have a lot of pieces that need that part...  so that code resizes the picture in the picture box to stretch it back behind the label I added to the size of th epicture box...

So that visually its not working at all....

I also looked at a free discontinued CmdButton from Ariad that was nice but you could get the caption to align properly if the caption was "multi-line".  I added some code to test setting the Caption and including line brake characters in the caption.... that fixed the wrapping but hosed where the caption appears on the button....  so must have messed up the internal code of that command button....

Am still searching for a good solution... :-(
0
 
torrid333Author Commented:
There was a way to turn off the resizing of the picture box in the autoresize control.... not ideal because it would look better of the icons got bigger when maximizing... also using this method the button does not appear to click when you actually click  the icon or text label.  I also had to find and use a Transparent Image control that allowed me to set the mask color on the image to match the underlying button.  Thanks KarcOrigin
0
 
torrid333Author Commented:
I guess I spoke too soon....  after compiling my app and testing it on Windows ME --- the MaskColor does not work properly.  On XP The MaskColor matches the icon background and gets masked out so that the underlying button face color shows thru around the icons/picture boxes used for button icons...

On Windows ME though the masking does not occur... it just shows the pictures surrounded by a white box and the white is not masked out.

Boo hoo anyone have any ideas?

Regards,
-Tim
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.