Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

George C.K. Low

  • Leaders
Posted

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.

[sIGPIC]e[/sIGPIC]
  • *Experts*
Posted

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.

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

Posted

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.

George C.K. Low

Posted

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..

George C.K. Low

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...