The steps are as follows:
1. Create a new form and hide the title bar.
2. Import the image as a form BackgroundImage. Set the BackgroundImageLayout property to Strech appropriately.
3. Import the namespace so that two-dimensional graphics can be drawn:
Copy the codeThe code is as follows:
using .Drawing2D;
4. Add the following code to the form loading event:
Copy the codeThe code is as follows:
private void Form1_Load(object sender, EventArgs e)
{
= ( - ) / 2;
= ( - ) / 2;
}
5. At the same time, add the following code to the Paint event:
Copy the codeThe code is as follows:
private void Form1_Paint(object sender, PaintEventArgs e)
{
GraphicsPath Myformpath = new GraphicsPath();
(0,0,-30,-30);
= new Region(Myformpath);
}
6. Finally, add the following code to the DoubleClick event of the form so that double-click can exit the program:
Copy the codeThe code is as follows:
private void Form1_DoubleClick(object sender, EventArgs e)
{
();
}