Combobox borderstyle or flatstyle

  • Thread starter Thread starter ORC
  • Start date Start date
O

ORC

With buttons and textboxes etc. it is possible to set the orderstyle or
flatstyle but what about comboboxes? - is it possible to make them more up
to date?

Thanks,
Ole
 
Or you could call Application.EnableVisualStyles() in main() and you'll find
that you get the new XP styling on your comboboxes, which is sort of flat
with a sexed up button.

If you use visual styles remember to pump the message queue after you call
Application.EnableVisualStyles() and before you create any objects that
cache imagelists, or you'll get freaky COM errors at unexpected times.

In fact just make it policy to always code like this

void main() {
....
Application.EnableVisualStyles();
Application.DoEvents();
....
}

and it will save you untold grief. Frankly I'd like to box the ears of
whoever failed to make the EnableVisualStyles() method pump the message
queue itself. It's always safe to do and sometimes crucial. You'd be amazed
how many widgets use imagelists internally.

To get the styles to apply to text boxes and for that matter anything that
has a FlatStyle property, set the FlatStyle to System. Anything that lacks a
FlatStyle property, you just have to pray. With comboboxes you're in luck.
 
Thanks! looks great. Just ensure that I understand ir correctly: is DoEvents
enough to pump the message que? Nothing else but the 2 lines are necessary?

Thanks,
Ole
 
Back
Top