Vertical Alignment -TextFields

Greetings all!

Does anyone know of any text classes (textfield, label, text area) have a way to align the text vertically?

Not right, left, centre alignment, but (as in HTML) top, middle and bottom.

Many thanks - these forums are great!! :slight_smile:

[quote=190961:@Doug Smith]Greetings all!

Does anyone know of any text classes (textfield, label, text area) have a way to align the text vertically?

Not right, left, centre alignment, but (as in HTML) top, middle and bottom.

Many thanks - these forums are great!! :)[/quote]

You already have liddle and top in a Label. Middle is the default, you get Top by switching to Multiline.

Thanks for that, but what I really need is “bottom” align.

But bottom align is what you get if you do nothing special.
(Unless you want the descenders like the tails on y,p,j etc to move up to the same spot as the last dot of the letter m…)

Do this on a multiline label.

Sub Action() #if TargetWin32 then App.UseGDIPlus = True #Endif dim pic as new picture(1,1) pic.graphics.TextFont = Label1.TextFont pic.graphics.TextSize = Label1.TextSize dim eols as string for i as integer = 4 to Label1.Height/pic.graphics.StringHeight(Label1.Text,Label1.Width) eols = eols+EndOfLine next Label1.Text = eols+Label1.Text End Sub

It works on a TextField as well.

Thanks MIchael, but this doesn’t seem to work consistently, though there may be some variables I need to adjust.

I think that answer to my question is that there is no built-in property that allows the text to flow in this manner.

This is an image of what I am trying to do:

[quote=190981:@Doug Smith]Thanks MIchael, but this doesn’t seem to work consistently, though there may be some variables I need to adjust.

I think that answer to my question is that there is no built-in property that allows the text to flow in this manner.

This is an image of what I am trying to do:
[/quote]

No, there is no built in property. Since everything in text controls is based on left and top, scrolling à la Star Wars is not very simple.

You could use a canvas and use graphics.stringheight to draw the text at the bottom of the control or use an HTMLViewer to render it aligned the way you want.

forexample in a canvas.paint event

g.drawstring( thestring , 0 , g.height - g.stringheight( thestring , g.width ) , g.width )

There is no simple (built-in) solution to an editable TextArea/TextField, not even via declares.