如何在Windows窗体中为弹出窗口设置位置? [英] How to set a location for a popup window in windows form?
本文介绍了如何在Windows窗体中为弹出窗口设置位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在一种形式中,我有一个datagridview,其中包含我的xml文件的内容.我在单元格上单击鼠标右键打开一个弹出设置窗口.弹出设置窗口是另一种形式.
我已经编写了用于打开弹出式设置窗口表单的代码.但它显示在屏幕的最上方.如何在datagridview中的currentcell下方设置弹出设置窗口窗体的位置.
我尝试过的事情:
In a form I have a datagridview which has a contents of my xml file. I am opening a popup settings window to on cell right click. Here popup setting window is a another form.
I have written a code for opening a popup setting window form. but it is showing on the topmost corner of the screen. how to set the location of the popup setting window form below the currentcell in a datagridview.
What I have tried:
private void dataGridView1_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
private frmDGVColList objform = new frmDGVColList();
objform.StartPosition = FormStartPosition.Manual;
objform.Location = dataGridView1.PointToScreen(dataGridView1.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false).Location);
objform.Show(this.dataGridView1);
}
}
推荐答案
这似乎是您正在寻找的内容: ^ ]
This seems to be what you are looking for: c# - Open a popup from just below of current selected cell of datagrid view - Stack Overflow[^]
这篇关于如何在Windows窗体中为弹出窗口设置位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文