From: Liberado27 on
Hi,

I want to use a Textbox in my app that the user can't edit and select
anything on it. To do it I have to disable (Enabled = false) but when I do
that the text color change to grey.

How can I change a disabled textbox's forecolor? or how can I prevent the
selection of text?

Thank you very much.
From: Michael Salamone on
Did you try setting the ForeColor property?

Is the "how can I prevent selection" question separate? Or that's what you
want the final result to be? I.e. you don't really care what color it is as
long as you prevent selection of text? In any case, not sure why you'd want
to prevent selection (why would you?), but probably the only way to do it is
handle mouse events. For example, create a MouseClick handler and probably
have it do nothing -just return. Can get sticky, so be careful! You could
end up with unintended side effects.

--
Michael Salamone, eMVP
Entrek Software, Inc.
www.entrek.com


"Liberado27" <Liberado27(a)discussions.microsoft.com> wrote in message
news:E97A2B94-E7AF-496E-8E0F-A59FEDF94BE1(a)microsoft.com...
> Hi,
>
> I want to use a Textbox in my app that the user can't edit and select
> anything on it. To do it I have to disable (Enabled = false) but when I do
> that the text color change to grey.
>
> How can I change a disabled textbox's forecolor? or how can I prevent the
> selection of text?
>
> Thank you very much.

From: Liberado27 on
My goal is prevent selection.

I can achived that if I disable the TextBox, but if I do that the text color
gone grey. Because of that I want to change the forecolor when the textbox is
disabled.

My app is for Windows Mobile 5.0 and Compact Framework 2.0.

Thanks for your answer.


"Michael Salamone" wrote:

> Did you try setting the ForeColor property?
>
> Is the "how can I prevent selection" question separate? Or that's what you
> want the final result to be? I.e. you don't really care what color it is as
> long as you prevent selection of text? In any case, not sure why you'd want
> to prevent selection (why would you?), but probably the only way to do it is
> handle mouse events. For example, create a MouseClick handler and probably
> have it do nothing -just return. Can get sticky, so be careful! You could
> end up with unintended side effects.
>
> --
> Michael Salamone, eMVP
> Entrek Software, Inc.
> www.entrek.com
>
>
> "Liberado27" <Liberado27(a)discussions.microsoft.com> wrote in message
> news:E97A2B94-E7AF-496E-8E0F-A59FEDF94BE1(a)microsoft.com...
> > Hi,
> >
> > I want to use a Textbox in my app that the user can't edit and select
> > anything on it. To do it I have to disable (Enabled = false) but when I do
> > that the text color change to grey.
> >
> > How can I change a disabled textbox's forecolor? or how can I prevent the
> > selection of text?
> >
> > Thank you very much.
>
From: Scott Seligman on
=?Utf-8?B?TGliZXJhZG8yNw==?= <Liberado27(a)discussions.microsoft.com> wrote:
>
>My goal is prevent selection.
>
>I can achived that if I disable the TextBox, but if I do that the text color
>gone grey. Because of that I want to change the forecolor when the textbox is
>disabled.

If you want a text box that can't be selected and can't be edited, why
not use a static (label)?

--
--------- Scott Seligman <scott at <firstname> and michelle dot net> ---------
Luck is probability taken personally.
-- Chip Denman
From: Liberado27 on
Because I need a multiline control with scrollbars.

"Scott Seligman" wrote:

> =?Utf-8?B?TGliZXJhZG8yNw==?= <Liberado27(a)discussions.microsoft.com> wrote:
> >
> >My goal is prevent selection.
> >
> >I can achived that if I disable the TextBox, but if I do that the text color
> >gone grey. Because of that I want to change the forecolor when the textbox is
> >disabled.
>
> If you want a text box that can't be selected and can't be edited, why
> not use a static (label)?
>
> --
> --------- Scott Seligman <scott at <firstname> and michelle dot net> ---------
> Luck is probability taken personally.
> -- Chip Denman
>