Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 检测.net CF 3.5中状态栏控件上的点击_C#_.net_Compact Framework - Fatal编程技术网

C# 检测.net CF 3.5中状态栏控件上的点击

C# 检测.net CF 3.5中状态栏控件上的点击,c#,.net,compact-framework,C#,.net,Compact Framework,我正在使用Windows6专业移动设备开发一个C#应用程序。我想在用户点击状态栏然后显示列表框时检测事件。.NET CF状态栏没有键关闭或除文本更改或父级更改以外的事件。我如何处理这个问题 谢谢,我实际上没有尝试过这么多,但是如果我必须解决这个问题,我可能会尝试对父窗体进行子类化,并在状态栏所在的区域中查找鼠标消息。紧凑框架中的子类化表单有很多方法可以帮助您实现95%的目标。如果您谈论的是软件,您必须添加对Microsoft.WindowsCE.Forms的引用,然后在表单上放置一个输入面板控件

我正在使用Windows6专业移动设备开发一个C#应用程序。我想在用户点击状态栏然后显示列表框时检测事件。.NET CF状态栏没有键关闭或除文本更改或父级更改以外的事件。我如何处理这个问题


谢谢,

我实际上没有尝试过这么多,但是如果我必须解决这个问题,我可能会尝试对父窗体进行子类化,并在状态栏所在的区域中查找鼠标消息。紧凑框架中的子类化表单有很多方法可以帮助您实现95%的目标。

如果您谈论的是软件,您必须添加对
Microsoft.WindowsCE.Forms
的引用,然后在表单上放置一个输入面板控件

C++示例代码如下:

基本上,只需连接
输入面板
控件的唯一事件。不久前我做了这样的事情:

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();
}

控件。捕获应有助于您:

在窗体的构造函数中,将Capture属性设置为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";
    }
}