简体   繁体   English

vb.net组合框与C#组合框的样式不同

[英]vb.net combobox different style to C# combobox

When creating a combobox on the design surface of a VB.NET app in VS 2008 it is white and when creating it in C# it is gray. 在VS 2008中的VB.NET应用程序的设计图面上创建组合框时,它是白色的;在C#中创建时,它是灰色的。

How do I create a combobox in C# that looks just like the VB.NET one? 如何在C#中创建一个类似于VB.NET的组合框? (Style wise) (明智的方式)

alt text http://www.tonysoenen.com/images/combos.jpg 替代文字http://www.tonysoenen.com/images/combos.jpg

The different styles are because of the drop-down style of these controls. 不同的样式是由于这些控件的下拉样式。 To get the same style as for VB.NET, you can simply change the drop-down style property to "dropDown" for the ComboBox in C#. 要获得与VB.NET相同的样式,只需将C#中ComboBox的下拉样式属性更改为“ dropDown”即可。

Have you been using any custom controls? 您是否一直在使用任何自定义控件? If you mouse over the Toolbox entry before you drag the control to the form, does the tooltip in both cases say "Version 2.0.0.0 from Microsoft Corporation .NET component"? 如果在将控件拖到窗体上之前将鼠标悬停在“工具箱”项上,两种情况下的工具提示都说“来自Microsoft Corporation .NET组件的2.0.0.0版”吗?

You should check the all the properties of both forms and both comboboxes to make sure they are the same. 您应该检查两个表单和两个组合框的所有属性,以确保它们相同。 For example, it appears that your C# form has a different background color than the VB form. 例如,看来您的C#表单与VB表单具有不同的背景色。

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

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