这个对我来说很完美..
首先创建一个带有标签的警报表单。设置 label1 属性 -> Modifier = public
void showMsgOnAllScreens(string msg)
{
for (int i = 0; i < Screen.AllScreens.Length; i++)
{
AlertForm alert = new AlertForm();
alert.label1.Text = msg;
alert.StartPosition = FormStartPosition.Manual;
alert.Location = new Point(
Screen.AllScreens[i].Bounds.Left + (Screen.AllScreens[i].Bounds.Width / 2 - alert.Width / 2),
Screen.AllScreens[i].Bounds.Height / 2 - alert.Height / 2);
alert.Show();
}
}
.
.
.
现在只需调用该方法即可在所有屏幕上显示消息..
void button1_click (object sender, EventArgs e)
{
showMsgOnAllScreens("Warning.. Something's burning..!!");
}