我有这样的应用程序:
当用户单击主窗体上的按钮时,将出现黄色窗体,我希望黄色窗体出现在光标指向的位置。 (图中是26号按钮)。但它只是出现在其他地方(就像图片一样)
这是主窗体上按钮的onClick事件:
ChooseAnswer Answer = new ChooseAnswer();
Answer.Location = new Point(Cursor.Position.X, Cursor.Position.Y);
Answer.ShowDialog();
这有什么问题?
抱歉我的英文!
确定解决方案是:
ChooseAnswer Answer = new ChooseAnswer();
Answer.StartPosition = FormStartPosition.Manual;
Answer.Location = new Point(Cursor.Position.X, Cursor.Position.Y);
Answer.ShowDialog();
答案 0 :(得分:0)
试试这个;
ChooseAnswer Answer = new ChooseAnswer();
Answer.Top = Cursor.Position.Y;
Answer.Left = Cursor.Position.X;
Answer.ShowDialog();