using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace HelloWorld
{
public partial class Form2 : Form
{
int oldX, oldY;
public Form2()
{
InitializeComponent();
}
//窗体加载时,设置窗体的显示的初始位置为屏幕的右下角。
private void Form2_Load(object sender, EventArgs e)
{
oldX = Screen.PrimaryScreen.WorkingArea.Width-this.Width;
oldY = Screen.PrimaryScreen.WorkingArea.Height;
this.Location = new Point(oldX,oldY);
}
private void button1_Click(object sender, EventArgs e)
{
if (((Button)sender).Text.Equals("1"))
{
this.button1.BackColor = Color.Red;
}
}
private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
//显示消息框
private void 显示消息ToolStripMenuItem_Click(object sender, EventArgs e)
{
for (int y1 = 0; y1 < this.Height; y1++ )
{
this.Location = new Point(oldX, oldY-y1);
System.Threading.Thread.Sleep(10);
this.Refresh();
}
}
}
}