我会在 ActiveWorkbook 中居中表单,如何获取工作簿的屏幕/窗口位置?
问问题
1699 次
2 回答
1
C# 示例..
private void setFormPos(Form frm)
{
int top = Application.Top + Application.PageSetup.TopMargin + Application.PageSetup.HeaderMargin + Application.Commandbars["Ribbon"].Height;
int left = Application.Left + Application.PageSetup.LeftMargin;
frm.Left = (left / 2);
frm.Top = (top / 2);
}
于 2009-10-28T21:59:06.193 回答
0
没有找到好的解决方案,但找到了一个可以接受的解决方案:
int top = Application.Top + Application.PageSetup.TopMargin + Application.PageSetup.HeaderMargin + Application.Commandbars["Ribbon"].Height;
int left = Application.Left + Application.PageSetup.LeftMargin;
Form popup = new Form{ Top = top, Left = left, StartPosition = FormStartPosition.Manual, Width=400, Height=300};
popup.Show();
于 2009-10-25T22:32:04.527 回答