Click here to Skip to main content
15,899,754 members
Home / Discussions / C#
   

C#

 
GeneralPaint a region of a panel Pin
sreejeshtr14-Apr-05 19:19
sreejeshtr14-Apr-05 19:19 
GeneralRe: Paint a region of a panel Pin
Alex Korchemniy14-Apr-05 20:10
Alex Korchemniy14-Apr-05 20:10 
GeneralRe: Paint a region of a panel Pin
sreejeshtr14-Apr-05 20:52
sreejeshtr14-Apr-05 20:52 
GeneralRe: Paint a region of a panel Pin
Alex Korchemniy14-Apr-05 22:41
Alex Korchemniy14-Apr-05 22:41 
GeneralRe: Paint a region of a panel Pin
Ashok Dhamija15-Apr-05 0:03
Ashok Dhamija15-Apr-05 0:03 
GeneralRe: Paint a region of a panel Pin
Anonymous15-Apr-05 1:35
Anonymous15-Apr-05 1:35 
GeneralRe: Paint a region of a panel Pin
Mathew Hall14-Apr-05 23:57
Mathew Hall14-Apr-05 23:57 
GeneralControl mustn't change it ForeColor to grey, when it is disabled Pin
Ptmk14-Apr-05 19:17
Ptmk14-Apr-05 19:17 
I want that control (Label, TextBox) with property Enabled = false don't change it ForeColor to grey.
For example I have a UserControl with TextBox or Label on it. I can change TextBox property BackColor very easy:

private void UserControl1_EnabledChanged(object sender, System.EventArgs e)<br />
{<br />
    if(this.Enabled)<br />
    {<br />
    }<br />
    else<br />
    {<br />
        this.TextBox1.BackColor = System.Drawing.Color.White;<br />
    }<br />
}



But I can't change TextBox(Label) property ForeColor!

    private void UserControl1_EnabledChanged(object sender, System.EventArgs e)<br />
    {<br />
        if(this.Enabled)<br />
        {<br />
            this.BackColor = System.Drawing.Color.White;<br />
        }<br />
        else<br />
        {<br />
            this.textBox1.BackColor = System.Drawing.Color.White;<br />
            this.textBox1.ForeColor = System.Drawing.Color.Black;<br />
<br />
            this.Label1.ForeColor = System.Drawing.Color.Black;<br />
        }<br />
    }


This code can't do this!

If I make MyLabel by inheritance of Label and overide OnEnabledChanged(...), this will not help too:

protected override void OnEnabledChanged(EventArgs e)<br />
{<br />
    //base.OnEnabledChanged(e);<br />
}


If I put MyLabel on UserControl1 and then change Enable property of UserControl1 to false, the ForeColor property of MyLabel will not change!
But when I deactivate form with this control and then activate it, text of MyLabel will be grey.

Please, help!
GeneralRe: Control mustn't change it ForeColor to grey, when it is disabled Pin
Alex Korchemniy14-Apr-05 20:20
Alex Korchemniy14-Apr-05 20:20 
GeneralRe: Control mustn't change it ForeColor to grey, when it is disabled Pin
spif200114-Apr-05 20:29
spif200114-Apr-05 20:29 
Generalwhere Pin
alexdg0414-Apr-05 19:15
alexdg0414-Apr-05 19:15 
GeneralRe: where Pin
Disrupted14-Apr-05 19:28
Disrupted14-Apr-05 19:28 
GeneralA question on garbage collection Pin
DisruptedSinner14-Apr-05 19:14
DisruptedSinner14-Apr-05 19:14 
GeneralRe: A question on garbage collection Pin
spif200114-Apr-05 19:51
spif200114-Apr-05 19:51 
GeneralRe: A question on garbage collection Pin
Disrupted14-Apr-05 19:55
Disrupted14-Apr-05 19:55 
GeneralRe: A question on garbage collection Pin
Alex Korchemniy14-Apr-05 20:07
Alex Korchemniy14-Apr-05 20:07 
GeneralRe: A question on garbage collection Pin
Disrupted14-Apr-05 20:18
Disrupted14-Apr-05 20:18 
Generalautoesize or fit labels height Pin
alexdg0414-Apr-05 18:50
alexdg0414-Apr-05 18:50 
GeneralRe: autoesize or fit labels height Pin
Alex Korchemniy14-Apr-05 18:54
Alex Korchemniy14-Apr-05 18:54 
GeneralRe: autoesize or fit labels height Pin
alexdg0414-Apr-05 19:13
alexdg0414-Apr-05 19:13 
GeneralRe: autoesize or fit labels height Pin
Alex Korchemniy14-Apr-05 19:42
Alex Korchemniy14-Apr-05 19:42 
Generalminimize form while closeing Pin
alexdg0414-Apr-05 18:43
alexdg0414-Apr-05 18:43 
GeneralRe: minimize form while closeing Pin
Alex Korchemniy14-Apr-05 18:51
Alex Korchemniy14-Apr-05 18:51 
GeneralRe: minimize form while closeing Pin
Polis Pilavas15-Apr-05 4:45
Polis Pilavas15-Apr-05 4:45 
GeneralLog4Net - changing appender configuration programmatically... Pin
devvvy14-Apr-05 16:03
devvvy14-Apr-05 16:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.