简体   繁体   English

C#WinForm组合框的不同显示

[英]c# winform combobox different display

I am using Visual Studio 2010 and .NET 3.5 and I am seeing a combobox display differently in different project. 我正在使用Visual Studio 2010.NET 3.5并且在不同项目中看到的combobox显示方式有所不同。 I drop in the combobox the same way from the toolbox and change the dropdownstyle to DropDownList . 我以相同的方式从工具箱中放入combobox ,并将dropdownstyle更改为DropDownList But depending on the project, the combobox may look like it is indented (similar look as in DropDown ), with the field highlighted in blue. 但是根据项目的不同, combobox可能看起来像是缩进的(类似于DropDown外观),而该字段以蓝色突出显示。 But in the other project, the combobox has a more 3D feel. 但是在另一个项目中, combobox具有更3D的感觉。 I would love to provide a screenshot but I don't have enough reputation to post images. 我想提供一个屏幕截图,但我没有足够的声誉来发布图像。 :-( I am guessing it's probably due to some project settings maybe? Because I create the combobox the exact same way in both projects - I added a new Form and drop a combobox on the form and change the dropdownstyle to DropDownList ; however, they look differently in the dialog when the project is run. Any help would be appreciated. :-(我猜想这可能是由于某些项目设置引起的吗?因为我在两个项目中都以完全相同的方式创建了combobox -我添加了一个新的Form并将combobox拖放到该表单上,并将dropdownstyle更改为DropDownList ;但是,它们在运行项目时,对话框中的外观会有所不同,我们将不胜感激。

Solve my own problem. 解决我自己的问题。 Somehow Application.EnableVisualStyles(); 不知何故Application.EnableVisualStyles(); was removed in program.cs. 已在program.cs中删除。 Once I added Application.EnableVisualStyles(); 一旦我添加了Application.EnableVisualStyles(); before calling the main form, the comobobox looks the way I wanted 在调用主表单之前,comobobox看起来像我想要的样子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM