MilanJ
asked on
Text color on disabled label control
Maybe this is kind of a silly question, but I have a problem with changing the color of the text in disabled label control. It must be disabled, but I want not to be grey and not to be in 3D (I want to be flat text, without shades). Any help will be appreciated.
Thanks in advance...
Thanks in advance...
And why you want to make a label dissabled?
ASKER
It is a label, but I tried a linklabel that has property "Disabled Link Color", and it ignores my text color also (it is also grey and with shades). With linklabel I tried this in InitializeComponent:
this.lblReport.Enabled = false;
this.lblReport.DisabledLin kColor = System.Drawing.Color.FromA rgb(((Syst em.Byte)(0 )), ((System.Byte)(0)), ((System.Byte)(102)));
I'm talking about winforms.
I want to make label disabled because it is on the panel, and when mouse comes over the label (and label is enabled) my panel looses focus, and I need focus on my panel all the time because you can click on panel all the time (some kind simulation of a button, but a bit more complex one).
Maybe my english is not good, but I think you can understand what I mean.
this.lblReport.Enabled = false;
this.lblReport.DisabledLin
I'm talking about winforms.
I want to make label disabled because it is on the panel, and when mouse comes over the label (and label is enabled) my panel looses focus, and I need focus on my panel all the time because you can click on panel all the time (some kind simulation of a button, but a bit more complex one).
Maybe my english is not good, but I think you can understand what I mean.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@Chester M Regal
Thanks, but when I do that, I cannot see my form in design view (although this solution works just fine when I start the project), but this is (from my point of view) normal behaviour because I destroy its original OnPaint.
But, I came out with another solution, and I think this will work fine, too (and it doesn't break down the design view):
In InitializeComponent:
this.lblReport.Paint += new System.Windows.Forms.Paint EventHandl e(this.lbl Report_Pai nt);
and then:
private void lblReport_Paint(object sender, PaintEventArgs e)
{
Brush br = new SolidBrush(Color.Red);
e.Graphics.DrawString(this .lblReport .Text, this.lblReport.Font,br, this.lblReport.ClientRecta ngle);
}
What do you think?
Thanks, but when I do that, I cannot see my form in design view (although this solution works just fine when I start the project), but this is (from my point of view) normal behaviour because I destroy its original OnPaint.
But, I came out with another solution, and I think this will work fine, too (and it doesn't break down the design view):
In InitializeComponent:
this.lblReport.Paint += new System.Windows.Forms.Paint
and then:
private void lblReport_Paint(object sender, PaintEventArgs e)
{
Brush br = new SolidBrush(Color.Red);
e.Graphics.DrawString(this
}
What do you think?
>Thanks, but when I do that, I cannot see my form in design view (although this solution works just fine when I start the >project), but this is (from my point of view) normal behaviour because I destroy its original OnPaint.
>But, I came out with another solution, and I think this will work fine, too (and it doesn't break down the design view):
If you create that in a new project you can get the view..
>In InitializeComponent:
>this.lblReport.Paint += new System.Windows.Forms.Paint EventHandl e(this.lbl Report_Pai nt);
>and then:
>private void lblReport_Paint(object sender, PaintEventArgs e)
>{
> Brush br = new SolidBrush(Color.Red);
> e.Graphics.DrawString(this .lblReport .Text, this.lblReport.Font,br, this.lblReport.ClientRecta ngle);
>}
>
>What do you think?
This is another way(easy:)) of achiving the same task.
>But, I came out with another solution, and I think this will work fine, too (and it doesn't break down the design view):
If you create that in a new project you can get the view..
>In InitializeComponent:
>this.lblReport.Paint += new System.Windows.Forms.Paint
>and then:
>private void lblReport_Paint(object sender, PaintEventArgs e)
>{
> Brush br = new SolidBrush(Color.Red);
> e.Graphics.DrawString(this
>}
>
>What do you think?
This is another way(easy:)) of achiving the same task.
Are you talking about webforms or winforms?