hbash54 Posted August 27, 2003 Posted August 27, 2003 How can you disable the combobox and not have the control grayed out? Quote
Leaders dynamic_sysop Posted August 27, 2003 Leaders Posted August 27, 2003 set it's style to DropDownList , then set the Locked property to True, that will stop the text being altered in a combo box, hope that helps. Quote
hbash54 Posted August 27, 2003 Author Posted August 27, 2003 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. Quote
hbash54 Posted August 27, 2003 Author Posted August 27, 2003 I have found that the Locked property is only available at design time and is only for keeping the control from moving. Quote
*Experts* DiverDan Posted August 28, 2003 *Experts* Posted August 28, 2003 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 Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
hbash54 Posted August 28, 2003 Author Posted August 28, 2003 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. Quote
*Experts* Nerseus Posted August 28, 2003 *Experts* Posted August 28, 2003 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 Quote "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* DiverDan Posted August 28, 2003 *Experts* Posted August 28, 2003 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 Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
hbash54 Posted August 29, 2003 Author Posted August 29, 2003 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. Quote
*Experts* Nerseus Posted August 29, 2003 *Experts* Posted August 29, 2003 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 Quote "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
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.