【发布时间】:2011-11-02 17:19:29
【问题描述】:
我正在尝试为 MultiColumnComboBox (RadMultiColumnComboBox) 类型的组合框启动下拉列表单击。
我试图模拟的行为是当用户单击下拉列表的 [v] 按钮时,它显示了实际列表。
我的控件是 Telerik.WinControls.UI.RadMultiColumnComboBox。
我在 Telerik 论坛上看到一个帖子建议做这样的事情:
Dim item As RadTextBoxItem = TryCast(Me.radMultiColumnComboBox1.MultiColumnComboBoxElement.Children(2).Children(0).Children(0), RadTextBoxItem)
If item IsNot Nothing Then
AddHandler item.Click, AddressOf OnTextBoxItem_Click
End If
似乎是一个可行的解决方案,但我不确定这将如何在我的 C# 控件上工作。
我还发现了一个 Win32 hack,但这不会通过代码审查:
// Declare the following in your class
[DllImport("user32.dll")]
public static extern int SendMessage(int hWnd, int msg, int wParam, IntPtr lParam);
public const int CB_SHOWDROPDOWN = 0x14F;
// In the leave event of combobox, use the following code:
SendMessage(comboBox1.Handle.ToInt32(), CB_SHOWDROPDOWN, 1, IntPtr.Zero);
如果有人熟悉 WinForms ComboBox 并能帮助我弄清楚如何启动 Show Items/Elements/List 事件(或其他任何名称),我将不胜感激!
【问题讨论】:
标签: c# winforms winapi telerik