Winform rounded corner design, winform rounded corner Design

Source: Internet
Author: User

Winform rounded corner design, winform rounded corner Design

Many of the winform form rounded corner design codes displayed on the Internet are cumbersome. Here we will share a small amount of code to achieve the rounded corner. It mainly uses System. Drawing. Drawing2D.

  

The Code is as follows.

        private void BeautiLoginForm_Paint(object sender, PaintEventArgs e)        {            Type(this, 25, 0.1);        }        private void Type(Control sender, int p_1, double p_2)        {            GraphicsPath oPath = new GraphicsPath();            oPath.AddClosedCurve(new Point[] {                new Point(0, sender.Height / p_1),                new Point(sender.Width / p_1, 0),                new Point(sender.Width - sender.Width / p_1, 0),                new Point(sender.Width, sender.Height / p_1),                new Point(sender.Width, sender.Height - sender.Height / p_1),                new Point(sender.Width - sender.Width / p_1, sender.Height),                new Point(sender.Width / p_1, sender.Height),                new Point(0, sender.Height - sender.Height / p_1) }, (float)p_2);            sender.Region = new Region(oPath);        }        private void BeautiLoginForm_Resize(object sender, EventArgs e)        {            Type(this, 25, 0.1);        }

The code is relatively simple and may be helpful.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.