Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C#

Heart shaped Form in C# 2.0

4.73/5 (11 votes)
29 Mar 2011CPOL 28.4K  
Here is how we can make a Form in Heart shape.

The Form should have a minimum size with the followinhg dimensions: width=356, height=317.

In the Load event of the Form, write the following code:
C#
private void Form1_Load(object sender, EventArgs e)
{
    System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
    path.AddArc(70, 10, 150, 150, 135, 195);
    path.AddArc(200, 10, 150, 150, 210, 195);
    path.AddLine(92, 139, 210, 270);
    path.AddLine(327, 139, 210, 270);
    path.AddLine(327, 139, 92, 139);
    this.Region = new Region(path);
}

Just debug it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)