Solved

Command button, graphical with image and text...

Posted on 2004-09-09
22
392 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
ID: 12023600
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
ID: 12023695
What font and size would I set it to that would maximize the compatibility on displays?
0
 
LVL 14

Expert Comment

by:aelatik
ID: 12023761
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
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 

Author Comment

by:torrid333
ID: 12023780
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
ID: 12023830
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
ID: 12023860
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
ID: 12023934
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
ID: 12024317
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_
ID: 12024345
change the text alignment for the button to left.
0
 
LVL 7

Expert Comment

by:suramsureshbabu
ID: 12024383
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
ID: 12024568
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
 
LVL 26

Expert Comment

by:EDDYKT
ID: 12025606
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
ID: 12026508
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
ID: 12031246
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
ID: 12032419
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
ID: 12033557

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

0
 

Author Comment

by:torrid333
ID: 12047741
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
ID: 12053886
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
ID: 12054384
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
ID: 12057774
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
ID: 12069056
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
ID: 12071710
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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

773 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