Rafael Euclides


Hi all,

I need to put some text with justified alignment on my form, I tried Label and TextBox but none of then supports text justification.
How can i beat this problem

Thanks


Re: Text Alignment Justified

Rick


both support text justification using the TextAlign property





Re: Text Alignment Justified

Rafael Euclides

I tried it and the options are only left, right and center.

Can you write a example code

Thanks






Re: Text Alignment Justified

mkruluts

Maybe this might help you... Also keep in mind that in VB 2005 (at least the only on I know for sure) will do an auto complete and will give all of the text alignment options in the final part of the code.

What you need for a test run:

label called: lblText

button called: btnButton

Code Block

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

With lblText

.AutoSize = False

End With

End Sub

Private Sub btnButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnButton.Click

lblText.TextAlign = ContentAlignment.BottomRight

End Sub

End Class





Re: Text Alignment Justified

Rafael Euclides

lblText.TextAlign = ContentAlignment.BottomRight


This command keeps the horizontal
alignment on the right. i need to by justified.

I tried it here and didn't solve my problem





Re: Text Alignment Justified

Rick

Can you give us a more detailed explanation of what you mean by "justified"

What outcome are you trying to achive





Re: Text Alignment Justified

Rafael Euclides

Sorry, my (bad) english must be confusing you.

It's aligned on the left and right corner of the text. Just like in MS Word.

Thanks




Re: Text Alignment Justified

Dan Rhea

I believe what Rafael is asking for is "full" justification (like align="justify" in HTML).

For old school, this was done by inserting extra blanks between words so that the text filled the entire area between a left and right margin.

What would be required now (since not even the RichTextControl can manage full justification "out of the box"), is messing with the kerning between letters and spaces (character widths to be more precise) to achieve the same ends.

Unfortunatly I'm not even sure where to start when it comes to playing with letter spacing at the font level.






Re: Text Alignment Justified

Rafael Euclides

Thanks Dan, That's what i want to do.

Anyone knows how to solve this problem

Thanks