Odd behaviour when disable combo box

  • Thread starter Thread starter Ryan
  • Start date Start date
R

Ryan

In certain cases I have to disable a combo box so that the
entry cannot be changed.
However, when I disabled the combobox control, it changed
the combo box label. The thing is I dont know what propery
it changed, its not the fontweight. It made it look like
its etched in stone. Why it did this I have no idea. Its
weird. But I need to set it back to how it looks in the
designer.
 
If you don't want the appearance to change at all then Lock
the combobox instead of disabling it.
--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
 
Setting Enabled to False "dims" the control *and* any associated label. If
you only want to dim the control and not its label, you have 2 options:

1) Using Enabled: You can delete the associated label and create a new
non-associated label that won't dim along with its "parent" control.
However, doing this means that you can't set Accelerator/HotKey property for
that control, since that only comes from an associated label.

2) Not using Enabled: Set Locked to True instead and then either 1) change
the Backcolor (and, optionally, the Forecolor) or 2) set Backstyle to
Transparent. Whichever you chose, remember to change it back when you
unlock the control.

If making it transparent is workable it can be a robust and simple solution.
Resetting colors can be problematic because you can never guarantee what
color palettes a user may have in effect. However, if you want to use
BackColor/Forecolor and take System Colors into account:
http://office.microsoft.com/assistance/preview.aspx?AssetID=HP051878881033&C
TT=4&Origin=CH063662031033
This specific page resides in the Office 2003 documentation. It appears
identical to a hardcopy I've used for years that I printed from Office 2000.
However, I wasn't able to find that actual page. (Amazing that the most
useful articles that you ~know~ are there can be so *!!!* to find
sometimes.)

Hope this helps,
 
Back
Top