We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Changing to color of textbox when disabled

Thread ID:

Created:

Updated:

Platform:

Replies:

317 Jun 1,2002 08:56 AM UTC Jun 1,2002 07:45 PM UTC WinForms 1
loading
Tags: FAQ
jolly
Asked On June 1, 2002 08:56 AM UTC

When I set a TextBox to Readonly or set Enabled to false, the text color is gray. How can I force it to be the color specified in the ForeColor property of the TextBox. How would I do this in VB.net?

Clay Burch [Syncfusion]
Replied On June 1, 2002 07:45 PM UTC

For readonly, if you set the BackColor AFTER you set the ReadOnly property, then the cell will not look gray. For Enabled = False, setting the BackColor will not get rid of the gray text, but will take care of the gray background. For a disabled cell, if you really need to control the forecolor (& not just the backcolor), then one way to do this is to derive your own TextBox, override OnPaint and draw the text yourself using the paintevent arg passed in. This is doable, and works. You have to set the control's style to UserPaint with SetStyle in the constructor.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;