CodeImp.Gluon.DisplayCorner.UpdateRegion C# (CSharp) Метод

UpdateRegion() приватный Метод

private UpdateRegion ( ) : void
Результат void
        private void UpdateRegion()
        {
            Rectangle r = this.ClientRectangle;
            Point[] points = new Point[curvedetail + 3];
            byte[] types = new byte[curvedetail + 3];

            // First make the points along the right edges
            points[0] = new Point(0, r.Height);
            points[1] = new Point(0, 0);
            points[2] = new Point(r.Width, 0);
            types[0] = 0;	// start
            types[1] = 1;	// line
            types[2] = 1;	// line

            // Make the curve
            Point center = new Point(r.Width, r.Height);
            float startangle = 0;
            float endangle = -((float)Math.PI * 0.5f);
            for(int p = 0; p < curvedetail; p++)
            {
                float u = (float)(p + 1) / (float)(curvedetail + 1);
                float a = startangle + u * (endangle - startangle);
                float x = (float)Math.Sin(a) * (float)r.Width;
                float y = -(float)Math.Cos(a) * (float)r.Height;
                points[p + 3] = new Point(center.X + (int)x, center.Y + (int)y);
                types[p + 3] = 1;	// line
            }

            // Flip if needed
            if(flipx)
            {
                for(int p = 0; p < curvedetail + 3; p++)
                    points[p].X = r.Width - 1 - points[p].X;
            }
            if(flipy)
            {
                for(int p = 0; p < curvedetail + 3; p++)
                    points[p].Y = r.Height - 1 - points[p].Y;
            }

            GraphicsPath path = new GraphicsPath(points, types);
            this.Region = new Region(path);
        }