|
| Author |
Message |
Broeden
Joined: 08 Aug 2007 Posts: 13
|
Posted: Thu Feb 07, 2008 10:01 am Post subject: ComboBox.BackColor when ComboBox.Enabled = false; |
|
|
Hi,
I need to inherit from av Combobox component and override a suitable
method to set the backcolor to white when the control is disabled. I
need the text to more readable in daylight.
In the full framework I can override WndProc(ref Message m), but in CF
this is not possible. Does anybody know how to do i?
/Broeden
Archived from group: microsoft>public>dotnet>framework>compactframework |
|
| Back to top |
|
 |
Broeden
Joined: 08 Aug 2007 Posts: 13
|
Posted: Thu Feb 07, 2008 4:17 pm Post subject: Re: ComboBox.BackColor when ComboBox.Enabled = false; |
|
|
Mistake by me. It's the Font Color I want to set i CF2.0. In .NET
Framework I needed to set the BackColor to get the same effect. But
principally the problem is the same I think.
/Broeden |
|
| Back to top |
|
 |
Jayesh
Joined: 30 Nov 2007 Posts: 5
|
Posted: Thu Feb 07, 2008 5:55 pm Post subject: Re: ComboBox.BackColor when ComboBox.Enabled = false; |
|
|
On Feb 7, 11:17 am, Broeden wrote:
> Mistake by me. It's the Font Color I want to set i CF2.0. In .NET
> Framework I needed to set the BackColor to get the same effect. But
> principally the problem is the same I think.
> /Broeden
Hi,
You can achieve read only effect with your own formatting on control.
Don't disable the combo box. Change the fore color to what ever you
want.
Move the focus to any other control on the form on get focus event of
combo box.
public Form1()
{
InitializeComponent();
comboBox1.Enabled = true;
comboBox1.ForeColor = Color.Blue;
comboBox1.SelectedIndex = 0;
}
private void comboBox1_GotFocus(object sender, EventArgs e)
{
textBox1.Focus();
}
Thanks,
Jayesh Modha |
|
| Back to top |
|
 |
Broeden
Joined: 08 Aug 2007 Posts: 13
|
Posted: Fri Feb 08, 2008 7:32 am Post subject: Re: ComboBox.BackColor when ComboBox.Enabled = false; |
|
|
Thanks Jayesh!
I have suspected there must be a simple solution. This seems to be the
one.
ComboBoxes and TextBoxes works OK. But it's not working on
numericUpDown controls. I can still increase and decrease the value.
/Broeden |
|
| Back to top |
|
 |
Jayesh
Joined: 30 Nov 2007 Posts: 5
|
Posted: Fri Feb 08, 2008 3:45 pm Post subject: Re: ComboBox.BackColor when ComboBox.Enabled = false; |
|
|
On Feb 8, 2:32 am, Broeden wrote:
> Thanks Jayesh!
>
> I have suspected there must be a simple solution. This seems to be the
> one.
>
> ComboBoxes and TextBoxes works OK. But it's not working on
> numericUpDown controls. I can still increase and decrease the value.
>
> /Broeden
Hi,
With numericUpDown, It might be more easy.
I just tried to set increment property to zero 0.
It has given the desired result.
this.numericUpDown1.Increment = new decimal(new int[] {0,0,0,0});
Try this, let's see if this works out.
Thanks,
Jayesh Modha |
|
| Back to top |
|
 |
Broeden
Joined: 08 Aug 2007 Posts: 13
|
Posted: Fri Feb 08, 2008 7:27 pm Post subject: Re: ComboBox.BackColor when ComboBox.Enabled = false; |
|
|
Thanks again,
I got the desired behavior by setting Minimum and Maximum to Value.
But your solution is a bit simpler because I don't have to keep track
on different Min/Max for each control.
/Broeden
|
|
| Back to top |
|
 |
|