儿童表格的位置 [英] Location of child form

查看:94
本文介绍了儿童表格的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们!!

我有一个表格CheckerList及其父表格Mainform。如果用户点击Mainform中的文本框TbEditedBy,那么checkerList应该恰好出现在指定文本框的位置。我使用下面的代码,但它不起作用..请帮我找一个解决方案..

先谢谢!!

Hi friends !!
I have a Form "CheckerList" and its parent form "Mainform".If the user click on the textbox "TbEditedBy" in Mainform then the checkerList should appear exactly at the location of the textbox specified.I used the below code but its not working.. Please help me to find a solution..
Thanks in Advance!!

private void TbEditedBy_Click(object sender, EventArgs e)
{
    TextBox TB = (TextBox)sender;
    CheckerList ch = new CheckerList();
    ch.StartPosition = FormStartPosition.Manual;
    ch.Location = TB.Location;
    ch.tb = TB;
    ch.ShowDialog();
}

推荐答案

简要回答如何获取表格的具体问题当第二个表单在第一个表单的代码中显示ShowDialog ...时,控件在另一个表单上的位置:
To give a short answer to the specific question of how to get a Form shown at the location of a Control on another Form when the second form is be shown with 'ShowDialog ... in the code for the first Form:
SecondForm f2 = new SecondForm();
f2.StartPosition = FormStartPosition.Manual;
f2.Location = PointToScreen(ControlOnFirstForm.Location);
f2.ShowDialog();


这篇关于儿童表格的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆