Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

There does not appear to be a "Locked" property for this component. When I type "dot", the intellisense does not show this property.

 

Please advise.

  • *Experts*
Posted

Maybe a simply method, but it'll work:

 

ComboBox1.BackColor = Color.White

ComboBox1.Enabled = False

 

The combobox is disabled, but only the drop down arrow is gray. The combobox's paint event can fix that though.

 

Hope that'll help

Dan

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

Posted
DiverDan - the combobox still has the graying problem, even with this idea, in that the text is still grayed and setting it to black does not override this.
  • *Experts*
Posted

Is this a dynamically enabled/disabled control? If it's never enabled, why use a combobox at all? If it toggles, I'd think you'd want it to look disabled to give the user a visual cue that it can't be changed. Otherwise, if I see a combobox with an enabled look but it doesn't dropdown, I'm going to report it as a bug! (Better not let me be one of your testers!)

 

-Ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
  • *Experts*
Posted

As Nerseus stated, I've also allowed the gray text color to show its disabled. I think its too confusing to the user if there is no indication that something has changed.

 

Other than that you'll probably have to draw the text and arrow manually with the WndProc Overrides event. I think the m.Msg for a combo box is &HF.

 

Dan

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

Posted

The existing application has this behavior. It is currently in use, as is, and the billion dollar business that the applicaion supports, and it's users are quite happy with the way the application behaves. As to wheither or not this gui decision is agreeable to Nerseus, DiverDan, or whoever reads this is not at all the issue.

 

The solution to a problem of "don't do that" is sidestepping the question and imposing your own requirement.

 

This question is prompted by having begun the process of porting the application to vb.net, nothing more than that.

  • *Experts*
Posted

Well if that's what the users have then maybe it's best not to change it, though I might still push to have it either work as "expected" (and that's not just me, that's a Windows standard) or use a different control (such as a Label) to display the value.

 

I see no way of overriding the background and text colors through standard properties. You may have to do it through custom drawing or using the Windows API - sorry, no help on this one though. You might try an alternative such as only filling the combo with the one value that's in it. Along with setting the DropDownStyle to list and maybe handling the DropDown event to close it back up (to make it look like it can't be dropped down), you might get closer to what's currently being used.

 

As a last ditch effort, you *could* use the ActiveX control from the VB project though I wouldn't do that unless you absolutely had to. This assumes the old project was using such a control and that it would in .NET.

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...