访问 WinCE ComboBox DroppedDown 属性 (.NET CF 2.0)
我正在实现对表单控件进行子类化的自定义行为,但我无法访问 ComboBox 的 DroppedDown 属性。查看帮助,它应该在 CF.NET 2.0 中受支持:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace xCustomControls
{
public partial class xComboBox : System.Windows.Forms.ComboBox
{
private ComboBox comboBox1;
public xComboBox()
{
InitializeComponent();
this.KeyDown += new KeyEventHandler(this.KeyDownHandler);
}
private void KeyDownHandler(object sender, KeyEventArgs e)
{
// DroppedDown doesn't appear in the IntelliSense of ComboBox.
// or this.comboBox1.
if (((ComboBox)sender).DroppedDown) // fail!
return;
switch (e.KeyData)
{
case Keys.Up:
case Keys.Enter:
case Keys.Down:
e.Handled = true;
this.Parent.SelectNextControl((Control)sender, e.KeyData != Keys.Up, true, true, true);
...
失败,'System.Windows.Forms.ComboBox' 不包含 'DroppedDown' 的定义,并且没有扩展方法 'DroppedDown' 接受类型为 ' 的第一个参数可以找到 System.Windows.Forms.ComboBox'
如何访问该属性?
TIA, 巴勃罗
I'm implementing custom behavior sub-classing the form controls, but I cannot manage to access the DroppedDown property of the ComboBox. Looking in the help, it's supposed to be supported in CF.NET 2.0:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace xCustomControls
{
public partial class xComboBox : System.Windows.Forms.ComboBox
{
private ComboBox comboBox1;
public xComboBox()
{
InitializeComponent();
this.KeyDown += new KeyEventHandler(this.KeyDownHandler);
}
private void KeyDownHandler(object sender, KeyEventArgs e)
{
// DroppedDown doesn't appear in the IntelliSense of ComboBox.
// or this.comboBox1.
if (((ComboBox)sender).DroppedDown) // fail!
return;
switch (e.KeyData)
{
case Keys.Up:
case Keys.Enter:
case Keys.Down:
e.Handled = true;
this.Parent.SelectNextControl((Control)sender, e.KeyData != Keys.Up, true, true, true);
...
fails with 'System.Windows.Forms.ComboBox' does not contain a definition for 'DroppedDown' and no extension method 'DroppedDown' accepting a first argument of type 'System.Windows.Forms.ComboBox' could be found
How can I access the property?
TIA,
Pablo
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
DroppedDown
属性不在紧凑框架中,但您可以使用如下内容:取自:http://msdn.microsoft.com/en-us/netframework/bb735847.aspx
The
DroppedDown
property is not in the compact-framework, but you can use some thing like this:Taken from: http://msdn.microsoft.com/en-us/netframework/bb735847.aspx