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 3 2734
Use StringFormatFlags.DirectionRightToLeft in your call to DrawString
--
Sijin Joseph http://www.indiangeek.net http://weblogs.asp.net/sjoseph
"Gidi" <sh*****@hotmail.com.dontspam> wrote in message
news:9E**********************************@microsof t.com... 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
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
"Sijin Joseph" wrote: Use StringFormatFlags.DirectionRightToLeft in your call to DrawString
-- Sijin Joseph http://www.indiangeek.net http://weblogs.asp.net/sjoseph
"Gidi" <sh*****@hotmail.com.dontspam> wrote in message news:9E**********************************@microsof t.com... 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
Thanks i found the answer... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: z_learning_tester |
last post by:
Hello, yes another beginner question that I'm sure is obvious to many here
:-)
My book is so bad. Really. It uses the exact same example of code for using
the new kw and for using virtual(in the...
|
by: Paul E Collins |
last post by:
I am writing a class that inherits from TextBox. My class,
UndoTextBox, extends the standard control by enabling multi-level undo
and redo operations.
Annoyingly, some of the affected properties...
|
by: Keith Smith |
last post by:
Could some one help me a little? I am trying to understand when/where you
would ever want to use "protected override..." code such as this. How is
this any different from creating a...
|
by: Richard |
last post by:
I have a requirement to put a GDI style circle or rectangle border around
the selected row of a datagrid/ It will overlap into the row above and below
the selected row. Doing this in a the OnPaint...
|
by: John Smith |
last post by:
Hi All;
I am using the HeaderAndDataAlignColumn class from Ken Tucker. I have
customized it for a wider row. I reposition the DrawString method so the
text is centered vertically in the row.
...
|
by: =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?= |
last post by:
HI there. I use IE7. We have a user with bad eyesight. he cannot read the
font when IE makes an input disabled (the light grey color font). I am able
to change the background to a different color...
|
by: Joshua |
last post by:
I'm creating a web control that has an image and a text box. I would
like to then override the Visible and Text property of the
usercontrol, so when you reference the visible property of the user...
|
by: Cylix |
last post by:
I would like to rewrite the textbox.click event.
But I cannot find the correct stuff on this matter, is it call
override?
Please give me some hints, Thanks!
|
by: Jason Huang |
last post by:
Hi,
How do I override a TextBox's KeyPress evnt? And how do we use it?
Thanks for help.
Jason
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: erikbower65 |
last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps:
1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal.
2. Connect to...
|
by: linyimin |
last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
|
by: kcodez |
last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
|
by: Taofi |
last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same
This are my field names
ID, Budgeted, Actual, Status and Differences
...
|
by: Rina0 |
last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
|
by: DJRhino |
last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer)
If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _
310030356 Or 310030359 Or 310030362 Or...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: Mushico |
last post by:
How to calculate date of retirement from date of birth
| |