Resolve how to draw the border angle of a control to an arc in C #

Source: Internet
Author: User
Tags tostring
The following is a C # in the control of the border angle to the arc of the implementation code is introduced, need friends can refer to the following copy code code as follows:


private void Draw (Graphics Graphics, control control)


        {


float X = float. Parse (Control. Width.tostring ())-1;


float Y = float. Parse (Control. Height.tostring ())-1;


pointf[] Pointfs = {


New PointF (2, 0),


New PointF (X-2, 0),


New PointF (X-1, 1),


New PointF (X, 2),


New PointF (X, Y-2),


New PointF (X-1, Y-1),


New PointF (X-2, Y),


New PointF (2, Y),


New PointF (1, Y-1),


New PointF (0, Y-2),


New PointF (0, 2),


New PointF (1, 1)


                };

GraphicsPath path = new GraphicsPath ();
Path. AddLines (POINTFS);

Pen pen = new Pen (Color.FromArgb (Color.Blue), 1);
Pen. DashStyle = Dashstyle.solid;
Graphics. DrawPath (pen, path);
}


First, you register the control with an event: the name of the control. paint+= the event name, and then the above function for reference, such as: Draw (E.graphics, This.control);

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.