在VS2008的C#中的组合框中隐藏箭头按钮
我需要隐藏组合框的箭头按钮 我希望在VS2008的C#中的组合框中隐藏箭头按钮,c#,winforms,visual-studio-2008,combobox,C#,Winforms,Visual Studio 2008,Combobox,我需要隐藏组合框的箭头按钮 我希望DropDownStyle属性等于ComboBoxStyle.DropDownList而不显示下拉箭头。我可以这样做吗 是否有其他控件可用于显示图像的下拉列表 谢谢你的帮助。你可以试着假装一下。用Textbox覆盖它,在Textbox的GotFocus()事件中,只需设置comboBox.Focus()您可以创建一个扩展控件,也可以在表单中覆盖comboBox的绘制事件 对于WPF: 对于Winform:尝试设置DropDownStyle=Simple和Heig
DropDownStyle
属性等于ComboBoxStyle.DropDownList
而不显示下拉箭头。我可以这样做吗
是否有其他控件可用于显示图像的下拉列表
谢谢你的帮助。你可以试着假装一下。用
Textbox
覆盖它,在Textbox的
GotFocus()事件中,只需设置comboBox.Focus()
您可以创建一个扩展控件,也可以在表单中覆盖comboBox的绘制事件
对于WPF:
对于Winform:尝试设置DropDownStyle=Simple和Height以仅显示一行(约24px)。对于WinForms,您可能喜欢基于在上下文菜单中弹出项目的按钮的此类,然后将所选项目的文本作为按钮文本:
public class DropList : Button
{
public event EventHandler TextChangedByUser;
private ContextMenu _CM = new ContextMenu();
private string[] _Items;
public string[] Items
{
get { return _Items; }
set
{
_Items = value;
_CM.MenuItems.Clear();
foreach (string sChoice in _Items)
{
MenuItem MI = _CM.MenuItems.Add(sChoice, MI_Click);
}
}
}
private void MI_Click(object sender, EventArgs e)
{
if (this.Text != (sender as MenuItem).Text)
{
this.Text = (sender as MenuItem).Text;
if (TextChangedByUser != null) TextChangedByUser.Invoke(this, new EventArgs());
}
}
protected override void OnClick(EventArgs e)
{
base.OnClick(e);
_CM.Show(this, new System.Drawing.Point(0, this.Height - 1));
}
}
这是哪个UI框架?WinForms,WPF,…?是否尝试将dropdownstyle属性值更改为simple?