Override the Textbox - question

G

Guest

hi,

i read in the web about how can i change the foreColor of a textBox when
it's set to enabled=false or readonly, and that what was written:

public MyTextBox()
{ // This call is required by the Windows.Forms Form Designer.

this.SetStyle(ControlStyles.UserPaint,true);


}
protected override void OnPaint(PaintEventArgs e)

{

SolidBrush drawBrush = new SolidBrush(Color.Blue); //Use the ForeColor
property

// Draw string to screen.
int sizes=this.Size.Width;
e.Graphics.DrawString(Text, new System.Drawing.Font("Microsoft Sans Serif",
8.5f, System.Drawing.FontStyle.Bold), drawBrush,0f,0f); //Use the Font
property

}

now my problem is that sometimes i need the text to be wrriten from right To
left and sometimes from left to write, i tried to change the alligment and
the rightToleft property but still the point(0,0) stays always from the left
side.

and my textbox sizes are different so i can i make it to write my text form
the right point of the text box to the left?

thanks
 
G

Guest

hi joseph,

i did it, but it doesn't help, still the 0,0 point is on the left side.
what i need to know is how can i know what is right point.

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top