TextAlign

georgepatotk

Contributor
Joined
Mar 1, 2004
Messages
432
Location
Malaysia
Usually we use

System.Windows.Forms.HorizontalAlignment for TextBox alignment, and
System.Drawing.ContentAlignment for Label alignment.

I am wondering how to make use of System.Drawing.ContentAlignment in TextBox.

Cause now I am faking the TextBox and make it looks like a Label. One of the property of the Label (.TextAlign) is a must in my situation. So, if you know, please helps....

100,000X thanks in advance.. hehe.... :D
 
The .TextAlign property is of type System.Windows.Forms.HorizontalAlignment. You can not use System.Drawing.ContentAlignment members for a text box. Textboxes do not support any type of vertical alignment except the default.

Have you tried making a UserControl that draws the text? Labels and textboxes are meant for different uses and do not have much functionability in common beyond the fact that they both contain text. You want to show unicode chars, but a label can't do this, right? You want to vertically center the text and add background images, but a textbox can't do this. I don't know if the Graphics.DrawString() method will draw the chinese characters you need, but I'm guessing that more likely than not it will. Try it, and if it works, make a user control.
 
marble_eater, the textbox control does not have a paint properity and thus can not support Graphics.DrawString.

George,
I will need to add that functionality into the ImageTextBox control I made for you. Please send me a PM with your contact email address.
 
marble_eater, I had tried the drawstring in Label. It doesn't seem to work.
DiverDan, I had sent my details to you. Thanks a lot for your kindly helps. I appreciate it a lot.
 
I had tried DrawString in TextBox, it works. But not for unicode. Anyway, thanks for your help, marble_eater.

Your nick is cute, wondering whether you had ever eaten any marble..
 
Back
Top