间接点击 [英] mdiparent click
本文介绍了间接点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
.net MDI表单的mdi父级上的单击,双击不起作用是否是错误?
The click ,double click on mdi parent of the .net MDI form does not work is it a bug?
推荐答案
好吧,如果不确切知道您单击的内容,这没什么大不了的.父级的灰色背景是一个单独的控件,即MdiClient,而不是窗体.您将使用以下代码为其注册一个click事件:
Well, that's not much to go on without knowing exactly what you click on. The gray background of the parent is a separate control, an MdiClient, not the form. You'd register a click event for it with code like this:
public Form1() {
InitializeComponent();
foreach (var ctl in this.Controls) {
if (ctl is MdiClient) {
(ctl as MdiClient).Click += Client_Click;
break;
}
}
}
private void Client_Click(object sender, EventArgs e) {
// etc...
}
这篇关于间接点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文