syntax for vertical alignment of a label

E

eschloss

Access 2003 / WinXP

I have a Form (Name: test) with (1) label on it so far (Name:
Output3_Label). I am trying to make the text align vertically within the
label. While searching for the answer, I came across what I believed would
be the best solution. However, I need help implementing it:

"overkill/... all of it.... slap a label on the form, tell it to Dock=Fill
.... then set the text alignment to center/center.... bam! centered text in
all directions... Oh, might need to turn off the autoSize property of the
label for any of this to work."

Are there any Dim declarations?
Is Me.Output3_Label.Dock = Fill not correct?
Does this need to be attached to a particular Form Event?
What is the correct syntax for text alignment?
What is the correct syntax for autosize?

Thanks,
 
A

Allen Browne

Dock? Fill? Who shipped you that idea? :)

Use the Properties box to figure out what the properties are called, e.g.
Text Align. In code omit the space, so it's TextAlign.

In many cases, the properties you see in the Properties box are numeric
(zero-based.) Center is the 3rd one (after General and Left), so you could
code:
Me.Label99.TextAlign = 2

Vertical is a True/False property, so:
Me.Label99.Vertical = True

I don't believe labels AutoSize. To calculate the size you need for the
particular caption, given a font name and size, you would need something
like this:
http://www.lebans.com/textwidth-height.htm

If you are trying to resize everything on a form, there are additional
problems you will need to solve, e.g. an option group needs to be large
enough to contain whatever you are resize within it, and simlarly for tab
pages.
 
E

eschloss

OK Allen, I plugged in your suggestions, but the text within the label
actually is displayed vertically. Is there another command to simply center
the text vertically? For example:
____________
l text l
l l
l____________l becomes->

____________
l l
l text l
l____________l

I do not need to AutoSize the label or resize anything on the Form.

I have also seen http://www.lebans.com/verticaljustification.htm
suggested, but Lebans says it is only for Access 2000.

Another solution I came across is below. I am having trouble implementing
this one also: http://www.vbforums.com/showthread.php?t=505561
 
A

Allen Browne

that's not my experience of how Access centres vertically.

AFAIK, the Lebans function works in A2000 or later (not just A2000.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top