textbox readonly backcolor

G

Guest

If I have a textbox with readonly set to true
The backcolor shown is "control"
However if you read the property it says Window

What controls setting of the backcolor property when it is ReadOnly
Can the defalut ReadOnly backcolor be changed, read, or set
Is there a way to determine the textbox's backcolor when it's ReadOnly property is true
 
H

Herfried K. Wagner [MVP]

* =?Utf-8?B?bm9zcGFtQGNybGYuY29t?= said:
If I have a textbox with readonly set to true.
The backcolor shown is "control".
However if you read the property it says Window.

What controls setting of the backcolor property when it is ReadOnly?

Windows' default settings, there is no property available to set this
color.
 
Y

Ying-Shen Yu[MSFT]

Hi,

If no customized backcolor was specified to a TextBox control, textbox will
use the default windows bahavior, as Herfried said, this color was set in
global windows appearance settings to keep the consitency of look and feel,
we don't have a way to change it for our application.

However you may still change the BackColor property of TextBox control when
it is disabled. If a color was set to the BackColor property explicitly,
TextBox will handle the background painting by itself, the back color will
not be changed with ReadOnly property. If you need use different color
depending on if the textbox is read only, the ReadOnlyChanged event may
help you.

Does it reslolve your problem?
If you have anything unclear about it, please feel free to reply this
thread.


Best regards,

Ying-Shen Yu [MSFT]
Microsoft Community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.
 
G

Guest

1) Is there a way to determine the backcolor when the control is
readonly (displays [Window], but it's not).

2) Is there an enumerated color value that describes the backcolor used
(e.g., is it [control])?

3) Can the system defalut ReadOnly backcolor used for controls be
changed, or set?
 
G

Guest

1) Is there a way to determine the backcolor when the control is
readonly (displays [Window], but it's not).

2) Is there an enumerated color value that describes the backcolor used
(e.g., is it [control])? Is the default backcolor?

3) Can the system defalut ReadOnly backcolor used for controls be
changed, or set?
 
Y

Ying-Shen Yu[MSFT]

Hi
see inline:

1) Is there a way to determine the backcolor when the control is
readonly (displays [Window], but it's not).

I didn't find a way to get the read only color, but by default the textbox
uses the SystemColors.Control if you don't set the BackColor explicitly.

2) Is there an enumerated color value that describes the backcolor used
(e.g., is it [control])?

Do you mean SystemColors?

3) Can the system defalut ReadOnly backcolor used for controls be
changed, or set?

We can not modify the system-wide settings in an application.
But you may override the read-only backcolor in your application, by
setting BackColor property explicitly.


Best regards,

Ying-Shen Yu [MSFT]
Microsoft Community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.
 

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