SoFunction
Updated on 2025-03-07

DOTNETBAR makes rounded form and rounded control code example

1. If you make a rounded form, the form will first inherit the DOTNETBAR:public partial class Form2 : .Office2007Form

Then add a DONTERBAR panel to the form, and then set the panel to fill the entire form

Then set the CornerType of the panel to Rounded, and then the form becomes rounded: = ;

2. If it is a rounded control, follow the example, put the panel on the control, then set it to fill, and then set the panel's CornerType to Rounded, and it will become a rounded control.

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

After working on a day today, I finally got a rounded form, but it was not DOTNETBAR. It turns out that DOTNETBAR cannot be implemented. The following is the code for implementing the rounded form.

 

Copy the codeThe code is as follows:

 /// <summary>
/// The redraw 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 = ;
            int height = ;

//Upper left
            (new Point(0, 5));
            (new Point(1, 5));
            (new Point(1, 3));
            (new Point(2, 3));
            (new Point(2, 2));
            (new Point(3, 2));
            (new Point(3, 1));
            (new Point(5, 1));
            (new Point(5, 0));
//Upper right
            (new Point(width - 5, 0));
            (new Point(width - 5, 1));
            (new Point(width - 3, 1));
            (new Point(width - 3, 2));
            (new Point(width - 2, 2));
            (new Point(width - 2, 3));
            (new Point(width - 1, 3));
            (new Point(width - 1, 5));
            (new Point(width - 0, 5));
//Lower right
            (new Point(width - 0, height - 5));
            (new Point(width - 1, height - 5));
            (new Point(width - 1, height - 3));
            (new Point(width - 2, height - 3));
            (new Point(width - 2, height - 2));
            (new Point(width - 3, height - 2));
            (new Point(width - 3, height - 1));
            (new Point(width - 5, height - 1));
            (new Point(width - 5, height - 0));
//Lower left
            (new Point(5, height - 0));
            (new Point(5, height - 1));
            (new Point(3, height - 1));
            (new Point(3, height - 2));
            (new Point(2, height - 2));
            (new Point(2, height - 3));
            (new Point(1, height - 3));
            (new Point(1, height - 5));
            (new Point(0, height - 5));

            Point[] points = ();

            GraphicsPath shape = new GraphicsPath();
            (points);

//Set the display area of ​​the form to an instance of GraphicsPath
            = new (shape);
        }