473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Disable Control without ForeColor change

Hi all

Is it possible to disable a Control in .Net but have the text colour always
in black?

I would rather use Enabled property rather than Readonly as it does
everything I need it to in one swoop (no tabstop, no focus etc.).

Any ideas?

Thanks
Kev
Nov 16 '05 #1
6 4462
Hi,

I would strongly discourage this

It can be VERY ocnfusing for the user, he may try to change a textbox that
looks like one he can change but cannot, it can be very frustating.
IMO it's better to change the control for a label, in this way there is no
confusion at all.
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Mantorok" <No**@tiscali.co.uk> wrote in message
news:ci**********@newsfeed.th.ifl.net...
Hi all

Is it possible to disable a Control in .Net but have the text colour always in black?

I would rather use Enabled property rather than Readonly as it does
everything I need it to in one swoop (no tabstop, no focus etc.).

Any ideas?

Thanks
Kev

Nov 16 '05 #2

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:uM***************@tk2msftngp13.phx.gbl...
Hi,

I would strongly discourage this

It can be VERY ocnfusing for the user, he may try to change a textbox that
looks like one he can change but cannot, it can be very frustating.
IMO it's better to change the control for a label, in this way there is no
confusion at all.


Not for our users, they are used to seeing read-only textboxes, my main
question that you have managed to totally avoid is - is it possible to
change the forecolor on a disabled control.

And I totally disagree that changing it to a label is better, it is not
consistent with most windows apps and if you have a field that may become
enabled it would be twice as confusing.

Kev
Nov 16 '05 #3
Kev,

You shouldn't rip into Ignacio ("my main question that you have managed
to totally avoid"). As he was taking the time to try and help.

As for changing the color of the text, the textbox control really defers
control to the system textbox. There is no way to really change the text,
unless you want to override the paint process, and paint it yourself. You
might be able to do it, if you are able to get the proper metrics, but
having to do so is a pain.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Mantorok" <No**@tiscali.co.uk> wrote in message
news:ci**********@newsfeed.th.ifl.net...

"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us>
wrote
in message news:uM***************@tk2msftngp13.phx.gbl...
Hi,

I would strongly discourage this

It can be VERY ocnfusing for the user, he may try to change a textbox
that
looks like one he can change but cannot, it can be very frustating.
IMO it's better to change the control for a label, in this way there is
no
confusion at all.


Not for our users, they are used to seeing read-only textboxes, my main
question that you have managed to totally avoid is - is it possible to
change the forecolor on a disabled control.

And I totally disagree that changing it to a label is better, it is not
consistent with most windows apps and if you have a field that may become
enabled it would be twice as confusing.

Kev

Nov 16 '05 #4
Hi,

Not for our users, they are used to seeing read-only textboxes, my main
question that you have managed to totally avoid is - is it possible to
change the forecolor on a disabled control.
I was only trying to help you , remember that. If you still want to do this
you will have to draw the control by yourself, not an easy task. go to
www.opennetcf.org as they have a custom listbox that can give you ideas of
how to do it.
And I totally disagree that changing it to a label is better, it is not
consistent with most windows apps and
and how having controls that looks like enabled and are not is?
if you have a field that may become
enabled it would be twice as confusing.


I don't think so, a label is clear for everybody that can not be typed in,
a control that looks like enabled is and IMO will give more confusion.
But it's up to you , the designer, to decide that :)
Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Nov 16 '05 #5
On Thu, 16 Sep 2004 10:32:44 +0100, "Mantorok" <No**@tiscali.co.uk>
wrote:
Hi all

Is it possible to disable a Control in .Net but have the text colour always
in black?

I would rather use Enabled property rather than Readonly as it does
everything I need it to in one swoop (no tabstop, no focus etc.).


Put whatever control(s) you want "disabled" on a Panel control and
then disable the panel. That shouldn't disturb anything else.

Dunno why some of these other clowns are saying the sky is falling...

Oz
--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Nov 16 '05 #6

Hi,

Did you tried it before you post?

I just did, and guess what? It shows the textbox as disabled. exactly what
he is trying to do.

You should try first your solutions, especially when you will offend the
others that were trying to help.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"ozbear" <oz****@bigpond.com> wrote in message
news:414ab4d6.173576437@news-server...
On Thu, 16 Sep 2004 10:32:44 +0100, "Mantorok" <No**@tiscali.co.uk>
wrote:
Hi all

Is it possible to disable a Control in .Net but have the text colour alwaysin black?

I would rather use Enabled property rather than Readonly as it does
everything I need it to in one swoop (no tabstop, no focus etc.).


Put whatever control(s) you want "disabled" on a Panel control and
then disable the panel. That shouldn't disturb anything else.

Dunno why some of these other clowns are saying the sky is falling...

Oz
--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

Nov 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Lan H. Nguyen | last post by:
I have this line of code in my .aspx page <asp:HyperLink ID="hrefView" CssClass="main" ForeColor="blue" Runat="server" NavigateUrl='<%# "View.aspx?id=" + ID.ToString()%>'>View...
1
by: Steve Wonderful | last post by:
d define a disabled checkbox list and like to override the default grey color, what property of the control should I use? I tried forecolor, and others, but seemed not to work.
5
by: Bernie Yaeger | last post by:
When you use xp styles Application.EnableVisualStyles() Application.DoEvents() and you change a control's flat style to 'system', you then are not able to set the control's forecolor,...
11
by: PAul Maskens | last post by:
The form designer adds unnecessary code to the section when using a subclassed control. I've reproduced this in VS.NET 2002 and VS.NET 2003 so it's pretty fundamental. Outline steps: Create a...
13
by: Rich | last post by:
Hello, So I would like to disable a textbox on a vb.net form without the text getting grayed out. In vb6 I could place a textbox control on a frame control and disable the frame leaving the...
4
by: Matrixreloadedth | last post by:
How to change disable color of Checkbox??? I have a checkbox with forecolor in red but when i disable by set Enable properties to false forecolor is changed to gray color but i don't want it. how...
5
by: Ike | last post by:
Does anyone know how to disable a list box element in VB 6 ? Thanks Ike
2
by: Paul | last post by:
I am using the standard Calendar control in ASP.Net 2.0 and VB.Net and VS2005. Here is the code: <asp:calendar id="cldr_contract_date" runat="server" backcolor="#ffffff" width="250px"...
7
by: garyusenet | last post by:
I'm using krypton toolkit which has allowed me to make a cool looking form. However, when I set my textbox to disabled it is 'greyed' out. The grey colour isn't in keeping with the office 2007...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
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...
0
jinu1996
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...
0
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...
0
tracyyun
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...
0
agi2029
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,...
0
isladogs
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.