Solved

Command button, graphical with image and text...

Posted on 2004-09-09
22
390 Views
Last Modified: 2012-08-14
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
0
Comment
Question by:torrid333
  • 9
  • 3
  • 3
  • +7
22 Comments
 
LVL 14

Accepted Solution

by:
aelatik earned 25 total points
Comment Utility
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
 

Author Comment

by:torrid333
Comment Utility
What font and size would I set it to that would maximize the compatibility on displays?
0
 
LVL 14

Expert Comment

by:aelatik
Comment Utility
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
 

Author Comment

by:torrid333
Comment Utility
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
 
LVL 14

Expert Comment

by:aelatik
Comment Utility
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
 

Author Comment

by:torrid333
Comment Utility
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
 
LVL 3

Expert Comment

by:Hornet241
Comment Utility
This may not be the best way but you could edit the graphics and add the caption to the pictures.
0
 
LVL 11

Expert Comment

by:dbrckovi
Comment Utility
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
 
LVL 7

Expert Comment

by:_agj_
Comment Utility
change the text alignment for the button to left.
0
 
LVL 7

Expert Comment

by:suramsureshbabu
Comment Utility
can you change the display properties of the desktop and try to check. it might be the reason of the behaviour
0
 
LVL 5

Expert Comment

by:KarcOrigin
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 26

Expert Comment

by:EDDYKT
Comment Utility
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
 
LVL 100

Expert Comment

by:mlmcc
Comment Utility
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
 

Author Comment

by:torrid333
Comment Utility
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
 
LVL 5

Assisted Solution

by:KarcOrigin
KarcOrigin earned 475 total points
Comment Utility
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
 
LVL 5

Expert Comment

by:softpro2k
Comment Utility

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

0
 

Author Comment

by:torrid333
Comment Utility
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
 

Author Comment

by:torrid333
Comment Utility
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
 
LVL 5

Expert Comment

by:KarcOrigin
Comment Utility
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
 

Author Comment

by:torrid333
Comment Utility
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
 

Author Comment

by:torrid333
Comment Utility
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
 

Author Comment

by:torrid333
Comment Utility
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

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now