-
Oct 20th, 2012, 05:16 AM
#1
Thread Starter
Member
Text Alignment
Hello!
I want to seperate a line in a textbox, so that one part is aligned to the right and the other to the left.
I tried to do this by first:
- using TextBox1.Select(something,something)
' this selected the text I wanted to align to the right
- TextBox1.SelectionAlignment = HorizontalAlignment.Right
'but this aligns the whole row to the right.
Is there a way for text to be aligned in 2 ways in a row?
Sort of like this
-
Oct 20th, 2012, 06:33 AM
#2
Re: Text Alignment
Originally Posted by suzi9spal
Hello!
I want to seperate a line in a textbox, so that one part is aligned to the right and the other to the left.
I tried to do this by first:
- using TextBox1.Select(something,something)
' this selected the text I wanted to align to the right
- TextBox1.SelectionAlignment = HorizontalAlignment.Right
'but this aligns the whole row to the right.
Is there a way for text to be aligned in 2 ways in a row?
Sort of like this
The short answer is no. TextBox has only one horizontal alignment property and it applies to all the text.
The simplest way to make more complicated layouts is to use a container control like a Panel or a UserControl. For example, you could take a panel and place two text boxes or labels at the top, one on the left with the text aligned left, and the other on the right with the text aligned right. If these are intended as headings for a page, you could add another textbox beneath them to contain the rest of the text. To print the resulting layout, you could use the DrawToBitmap method of the container control, which will render it to a bitmap complete with the child controls.
BB
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|