2012-02-16 27 views
1

我正在开发一个使用Windows 6专业移动设备的C#应用​​程序。我想在用户点击状态栏并显示列表框时检测到事件。 .NET CF状态栏中没有任何按键或事件发生,但“文本”已更改或父项已更改。我如何处理这个问题?在.net CF中检测状态栏控件上的一个水龙头3.5

感谢,

回答

0

我还没有真正尝试过这种如此因人而异,但如果我必须解决这个问题,我想可能会尝试继承父窗体,该区域寻找鼠标消息在状态栏是。有涵盖紧凑框架中的子类化表单的an article in MSDN magazine,它应该能让你获得95%的方式。

0

在谈论Soft Input Panel时,您必须添加对Microsoft.WindowsCE.Forms的引用,然后将输入面板控件拖放到窗体上。

C++示例代码这里:http://support.microsoft.com/kb/264034

基本上,只要线了用于Input Panel控制的唯一事件。我做了这样的事情不是很久以前:

void SIP_EnabledChanged(object sender, EventArgs e) { 
    int locationY = Y_START; // defined as txtNote.Location.Y when the form loads 
    if (inputPanel1.Enabled) { 
    locationY -= inputPanel1.Bounds.Height; 
    } 
    txtNote.SuspendLayout(); 
    txtNote.Bounds = new Rectangle(
    txtNote.Location.X, 
    locationY, 
    txtNote.Size.Width, 
    txtNote.Size.Height 
); 
    txtNote.ResumeLayout(); 
    txtNote.Refresh(); 
} 
0

Control.Capture应该可以帮助您: http://msdn.microsoft.com/en-us/library/system.windows.forms.control.capture%28v=vs.80%29.aspx

在窗体的构造函数中捕获属性设置为True:

this.Capture = true; 

然后加入鼠标事件处理程序到您的表单。 例如: -

// This method handles the mouse down event for all the controls on the form. 
// When a control has captured the mouse 
// the control's name will be output on label1. 
private void Control_MouseDown(System.Object sender, 
    System.Windows.Forms.MouseEventArgs e) 
{ 
    Control control = (Control) sender; 
    if (control.Capture) 
    { 
     label1.Text = control.Name+" has captured the mouse"; 
    } 
} 

这将提高甚至孩子控制了点击。