[b]
步骤如下:[/b]
[b]1.新建窗体,并隐藏标题栏。[/b]
[b]2.导入图片为窗体BackgroundImage。适当将BackgroundImageLayout属性设置为Strech.[/b]
[b]3.导入命名空间以便可以绘制二维图形:
[/b]
using System.Drawing.Drawing2D;
[b]4.为窗体加载事件添加如下代码:
[/b]
private void Form1_Load(object sender, EventArgs e)
{
this.Left = (SystemInformation.PrimaryMonitorMaximizedWindowSize.Width - this.Width) / 2;
this.Top = (SystemInformation.PrimaryMonitorMaximizedWindowSize.Height - this.Height) / 2;
}
[b]5.同时为Paint事件添加如下代码:
[/b]
private void Form1_Paint(object sender, PaintEventArgs e)
{
GraphicsPath Myformpath = new GraphicsPath();
Myformpath.AddEllipse(0,0,this.Width-30,this.Height-30);
this.Region = new Region(Myformpath);
}
[b]6.最后为窗体的DoubleClick事件添加如下代码,以便双击可以退出程序:
[/b]
private void Form1_DoubleClick(object sender, EventArgs e)
{
Application.Exit();
}