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

Multi-line command-button lable?

I wish to have a command button which displays something like this:
-------------------------
+         Good            +
+      Afternoon        +
-------------------------

Where the lable is split over two lines, and the words "Reasonably" centered.
And I'm not fully sure which fonttype I'll use for the button, could be Courier, could be Tahoma, could be anything really.

Now in the developing environment, I have no problem with adding spaces and removing them to visually lay it out, I've done that no problem...  The problem comes in when the SYSTEM FONT SIZE changes.  System-font size, the one that is set through the Screen properties (one of the tabs one comes across when changing the screensaver or themes and such) {In XP, this is the monitor-advanced "DPI settings, normal/large", in other windows versions its the "Small fonts, large fonts or NNN% sized fonts)



When the System font size gets changed, the same space-padded lable generates an output like the following
-------------------------
+      Good               +
+  Afternoon            +
-------------------------

I currently have a function which will return true/false if the system is in NormalFonts (small) or LargeFonts (large), I'm not really interested in custom-sized system font displays at this time, but for completeness, I might be later.  I can choose between two different strings which I have to develop in designtime with my computer in each mode, and pick the lable that way, which is the current way I am using, but a way I wish to replace because its dependant on the design-time conditions.

I wish to have a routine that will stamp the lable onto the command bar using TWO STRING COMPONENTS Line1 and Line2.
The assumptions / intentions to be used:
-- Line1 and Line2 will both be narrower than the command button, no wrapping will occur
-- Font type nonspecific, so should be based on character width of the strings when chosen
-- Even if line1+line2 text < width of button, STILL to be shown as two lines
-- Needs to work in both large and small font modes

I know a solution is just out of my reach, or I'm not looking at something right.
No third-party controls, please, even if you really like one...

**VB6
0
GPrentice00
Asked:
GPrentice00
  • 2
1 Solution
 
Harisha M GCommented:
Hi GPrentice00,

Add this to the load event...

Private Sub Form_Load()
    Command1.Caption = "Good" & vbCr & "Afternoon"
End Sub


Bye
---
Harish
0
 
Harisha M GCommented:
GPrentice00,
    vbCr, vbLf, vbCrLf -- any one of these will do the job
0
 
GPrentice00Author Commented:
of course it would be that obvious - I tried the VBCR and VBCRLF before, but there was something else with my stupid button that must have caused a problem, making me go down the winding road...
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

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