MSDOTnet.org Forum Index
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ComboBox.BackColor when ComboBox.Enabled = false;

 
Post new topic   Reply to topic    MSDOTnet.org Forum Index -> Compact Framework
Author Message
Broeden



Joined: 08 Aug 2007
Posts: 13

PostPosted: Thu Feb 07, 2008 10:01 am    Post subject: ComboBox.BackColor when ComboBox.Enabled = false; Reply with quote

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
View user's profile Send private message
Broeden



Joined: 08 Aug 2007
Posts: 13

PostPosted: Thu Feb 07, 2008 4:17 pm    Post subject: Re: ComboBox.BackColor when ComboBox.Enabled = false; Reply with quote

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
View user's profile Send private message
Jayesh



Joined: 30 Nov 2007
Posts: 5

PostPosted: Thu Feb 07, 2008 5:55 pm    Post subject: Re: ComboBox.BackColor when ComboBox.Enabled = false; Reply with quote

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
View user's profile Send private message
Broeden



Joined: 08 Aug 2007
Posts: 13

PostPosted: Fri Feb 08, 2008 7:32 am    Post subject: Re: ComboBox.BackColor when ComboBox.Enabled = false; Reply with quote

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
View user's profile Send private message
Jayesh



Joined: 30 Nov 2007
Posts: 5

PostPosted: Fri Feb 08, 2008 3:45 pm    Post subject: Re: ComboBox.BackColor when ComboBox.Enabled = false; Reply with quote

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
View user's profile Send private message
Broeden



Joined: 08 Aug 2007
Posts: 13

PostPosted: Fri Feb 08, 2008 7:27 pm    Post subject: Re: ComboBox.BackColor when ComboBox.Enabled = false; Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Related Topics:
set BackColor for a datagrid row? Is it possible to set the BackColor for an individual datagrid row? I have seen it work withing .net framework but I'm not sure if .net compact framework has the capability.

Datagrid column backcolor ... Hi: I've seen postings and solutions for creating alternating 'row' colors in datagrids. I need to be able to have the 1st 'column' in a grid one color, and the rest of the columns another color. Is this possible? Thanks in advance. --Terry --- Outgoing

Setting Backcolor for individual DataGridRows I have an application that uses a datagrid. When a user adds rows to the datagrid, those new rows need to appear in a different color. Has anyone found a way to do this? Any help would be appreciated. Jim

Help with COMBOBOX control How do I return the VALUEMEMBER of the selected item in the combobox?

combobox inheritance All- I am attempting to create my own custom class which inherits from the ComboBox class. The problem is that I also need to use my own custom object collection for my custom class. I have already done this with a custom ListBox control by overriding the
Post new topic   Reply to topic    MSDOTnet.org Forum Index -> Compact Framework All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group