65.9K
CodeProject is changing. Read more.
Home

Heart shaped Form in C# 2.0

starIconstarIconstarIconstarIcon
emptyStarIcon
starIcon

4.73/5 (10 votes)

Mar 28, 2011

CPOL
viewsIcon

28549

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:
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.