ComboBox & XP Styles

M

Mika M

Hello!

I'm using VB.NET 2003 and Windows Forms application type.

Question: Why ComboBoxes are not changing their arrearance to XP-Styles look
althought other UI Components does when I use the following code in my Sub
Main ...

System.Windows.Forms.Application.EnableVisualStyles()
System.Windows.Forms.Application.DoEvents()
System.Windows.Forms.Application.Run(New frmMain)

.... is there a way to ensure it by forcing style change to ComboBoxes
somehow?
 
M

Mika M

Hi,
To get a control to display in an xp style you have to set its
flatstyle to flatstyle.system. The combobox doesnt support flatstyles.
Maybe this will help.
http://www.thecodeproject.com/vb/net/flatcombo.asp

http://msdn.microsoft.com/library/d...msapplicationclassenablevisualstylestopic.asp

Ken

Thanks Ken of your reply, but ...

I have made another smaller windows forms application too. It has the
following code (code below) on the same form (frmMain) as the only one
ComboBox, and this ComboBox XP style is working just fine without any extra
code or property. This is why I'm wondering why ComboBoxes XP style is not
working same way on the bigger application forms too. Any succestions?

<System.STAThread()> _
Public Shared Sub Main()
System.Windows.Forms.Application.EnableVisualStyles()
System.Windows.Forms.Application.DoEvents()
System.Windows.Forms.Application.Run(New frmMain)
End Sub

-- Mika
 
H

Herfried K. Wagner [MVP]

* "Mika M said:
I have made another smaller windows forms application too. It has the
following code (code below) on the same form (frmMain) as the only one
ComboBox, and this ComboBox XP style is working just fine without any extra
code or property. This is why I'm wondering why ComboBoxes XP style is not
working same way on the bigger application forms too. Any succestions?

Are you using any other controls (maybe 3rd party controls) on the form?
 
M

Mika M

Are you using any other controls (maybe 3rd party controls) on the form?

Yes, C1FlexGrid (.NET) in both applications - because I like to make simple
things by simple way too :)). This can't be reason for this problem because
ComboBoxes XP style is working just fine with smaller application. Anyway
when I created smaller application, even there ComboBoxes XP style was not
working immediately, but suddenly after few 'Run' modes it was ok :)

Bigger application contains also MainMenu, ImageList, ToolTip,
ErrorProvider, TabControl, CheckBox control. All these controls are VS.NET
controls - except C1FlexGrid (.NET).

There were also 'AddNew' -problem with CheckBox control, but of the link
http://support.microsoft.com/default.aspx?scid=kb;en-us;326440 I found how
to solve it. Is there collected list of bugs (possibly with solving aid too)
somewhere? I have also problems with DataBindings, but I'll try to go solve
them one by one :'(

-- Mika
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top