Click here to Skip to main content
Click here to Skip to main content
Alternative Tip

Tagged as

Go to top

Heart shaped Form in C# 2.0

, 6 Apr 2011
Rate this:
Please Sign up or sign in to vote.
My alternate uses the AddBezier method, and the size of the heart adjusts to the size of the form.private void Form1_Load(object sender, EventArgs e){ using(System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath()) { path.AddBezier(...
My alternate uses the AddBezier method, and the size of the heart adjusts to the size of the form.
 
private void Form1_Load(object sender, EventArgs e)
{
    using(System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath())
    {
        path.AddBezier( this.Width >> 1,  
                        this.Height >> 2, 
                        this.Width * 1.25f, 0f, 
                        this.Width, 
                        this.Height * 0.75f, 
                        this.Width >> 1, 
                        this.Height);
        path.AddBezier( this.Width >> 1, 
                        this.Height >> 2, 
                        - this.Width * .25f, 0f,
                        0f, 
                        this.Height * 0.75f, 
                        this.Width >> 1, 
                        this.Height);
        this.Region = new Region(path);
    }
}

License

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

Share

About the Author

intrueder
Software Developer DevelopEx
Ukraine Ukraine
No Biography provided

Comments and Discussions

 
GeneralThis also good. But cannot drag. Have 5 PinmemberToniyo Jackson6-Apr-11 21:36 
GeneralRe: Drags are already here: <a href="http://www.codeproject.com/... PinmemberInTRUEdeR7-Apr-11 14:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140922.1 | Last Updated 6 Apr 2011
Article Copyright 2011 by intrueder
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid