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(C ontrolStyles.Us erPaint,true);
}
protected override void OnPaint(PaintEv entArgs e)
{
SolidBrush drawBrush = new SolidBrush(Colo r.Blue); //Use the ForeColor
property
// Draw string to screen.
int sizes=this.Size .Width;
e.Graphics.Draw String(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 2764
Use StringFormatFla gs.DirectionRig htToLeft in your call to DrawString
--
Sijin Joseph http://www.indiangeek.net http://weblogs.asp.net/sjoseph
"Gidi" <sh*****@hotmai l.com.dontspam> wrote in message
news:9E******** *************** ***********@mic rosoft.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(C ontrolStyles.Us erPaint,true);
} protected override void OnPaint(PaintEv entArgs e)
{
SolidBrush drawBrush = new SolidBrush(Colo r.Blue); //Use the ForeColor property
// Draw string to screen. int sizes=this.Size .Width; e.Graphics.Draw String(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 StringFormatFla gs.DirectionRig htToLeft in your call to DrawString
-- Sijin Joseph http://www.indiangeek.net http://weblogs.asp.net/sjoseph
"Gidi" <sh*****@hotmai l.com.dontspam> wrote in message news:9E******** *************** ***********@mic rosoft.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(C ontrolStyles.Us erPaint,true);
} protected override void OnPaint(PaintEv entArgs e)
{
SolidBrush drawBrush = new SolidBrush(Colo r.Blue); //Use the ForeColor property
// Draw string to screen. int sizes=this.Size .Width; e.Graphics.Draw String(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 base class) then override(in the
derived class), but fails to compare and contrast the two...
I've read this (short snippet)three times and by the looks of it they both
do exactly the same thing- allow you to derive from the base and save...
|
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 and methods (such as
CanUndo and Clear) are not virtual and therefore cannot be overridden.
I have hacked around this by declaring 'new' methods, e.g.
public new bool CanUndo
{
|
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 SelectedTextChanged type event?
This is an example I found on the web...
protected override void OnTextChanged(System.EventArgs e)
{
try
|
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 of a subclassed
DataGridTextBoxColum dos not seem like a practical way to do it.
I have subclassed a DataGrid and overridden the OnPaint as such:
|
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.
My problem now is that on ReadOnly cells the shaded background is not at the
top of the cell. I adjust the rectangle Height so that the shading does not
drop into the next 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 to white to try and increase a
contrast, but he still cant read it. Does anyone know a workaround to
override this font behaviour when an input is disabled="disabled" ???
|
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
control it only set the visible property of the textbox.
When i call these newly created property I get the following error:
Object reference not set to an instance of an object.
Does anybody have any idea? Thank you.
|
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: 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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |