DOTNETBAR makes rounded forms and rounded control code instances

  • 2020-05-19 05:41:58
  • OfStack

1, if make the rounded forms, form first inherited DOTNETBAR: public partial class Form2: DevComponents. DotNetBar. Office2007Form

Then add one panel of DONTERBAR to the form, and set panel to fill to fill the entire form

And then set panel CornerType Rounded, then form into a rounded corners: panelEx1. Style. CornerType = DevComponents. DotNetBar. eCornerType. Rounded;

2, if the rounded corner control is a copy, put panel on the control, and then set to fill, and then set panel CornerType Rounded to become rounded corner control

The button control of DOTNETBAR can be set to rounded buttons by default

Today, it took me one day to make the form with rounded corners. However, DOTNETBAR was not used, and DOTNETBAR could not be realized. The following is the code to realize the form with rounded corners


 /// <summary>
        ///  The redrawn form is rounded 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DispenserForm_Paint(object sender, PaintEventArgs e)
        {
            Form form = ((Form)sender);
            List<Point> list = new List<Point>();
            int width = form.Width;
            int height = form.Height;
            // Upper left 
            list.Add(new Point(0, 5));
            list.Add(new Point(1, 5));
            list.Add(new Point(1, 3));
            list.Add(new Point(2, 3));
            list.Add(new Point(2, 2));
            list.Add(new Point(3, 2));
            list.Add(new Point(3, 1));
            list.Add(new Point(5, 1));
            list.Add(new Point(5, 0));
            // The upper right 
            list.Add(new Point(width - 5, 0));
            list.Add(new Point(width - 5, 1));
            list.Add(new Point(width - 3, 1));
            list.Add(new Point(width - 3, 2));
            list.Add(new Point(width - 2, 2));
            list.Add(new Point(width - 2, 3));
            list.Add(new Point(width - 1, 3));
            list.Add(new Point(width - 1, 5));
            list.Add(new Point(width - 0, 5));
            // The lower right 
            list.Add(new Point(width - 0, height - 5));
            list.Add(new Point(width - 1, height - 5));
            list.Add(new Point(width - 1, height - 3));
            list.Add(new Point(width - 2, height - 3));
            list.Add(new Point(width - 2, height - 2));
            list.Add(new Point(width - 3, height - 2));
            list.Add(new Point(width - 3, height - 1));
            list.Add(new Point(width - 5, height - 1));
            list.Add(new Point(width - 5, height - 0));
            // The lower left 
            list.Add(new Point(5, height - 0));
            list.Add(new Point(5, height - 1));
            list.Add(new Point(3, height - 1));
            list.Add(new Point(3, height - 2));
            list.Add(new Point(2, height - 2));
            list.Add(new Point(2, height - 3));
            list.Add(new Point(1, height - 3));
            list.Add(new Point(1, height - 5));
            list.Add(new Point(0, height - 5));
            Point[] points = list.ToArray();
            GraphicsPath shape = new GraphicsPath();
            shape.AddPolygon(points);
            // Sets the display area of the form to GraphicsPath An instance of the 
            form.Region = new System.Drawing.Region(shape);
        }
 


Related articles: