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 2758
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: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |