Disable Control without ForeColor change

  • Thread starter Thread starter Mantorok
  • Start date Start date
M

Mantorok

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
 
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 ( .NET/ C# MVP ) said:
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
 
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.
 
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,
 
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
 
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,
 
Back
Top