예제 #1
0
        void DrawCurve(FadeIs fadeIs, CurveType curve, Graphics graphics)
        {
            Point p1 = new Point();
            Point c1 = new Point();
            Point c2 = new Point();
            Point p2 = new Point();

            Point FadeInLeftBottom = new Point(BoxLeft, BoxBottom);
            Point FadeInRightTop   = new Point(Convert.ToInt32(0.25 * Box.Width), BoxTop);

            Point FadeOutLeftTop     = new Point(Convert.ToInt32(0.75 * Box.Width), BoxTop);
            Point FadeOutRightBottom = new Point(Box.Width, BoxBottom);

            int FadeLength = FadeInRightTop.X;

            if (fadeIs == FadeIs.In)
            {
                switch (curve)
                {
                case CurveType.Fast:
                    // In Fast Curve
                    p1 = FadeInLeftBottom;                                           // Start point
                    c1 = new Point(BoxLeft, Convert.ToInt32(BoxBottom * 0.5));       // First control point
                    c2 = new Point(Convert.ToInt32(FadeInRightTop.X * 0.5), BoxTop); // Second control point
                    p2 = FadeInRightTop;                                             // Endpoint
                    break;

                case CurveType.Linear:
                    // In Linear Curve
                    p1 = FadeInLeftBottom;    // Start point
                    c1 = FadeInLeftBottom;    // First control point
                    c2 = FadeInRightTop;      // Second control point
                    p2 = FadeInRightTop;      // Endpoint
                    break;

                case CurveType.Sharp:
                    // In Sharp Curve
                    p1 = FadeInLeftBottom;                                               // Start point
                    c1 = new Point(BoxLeft, Convert.ToInt32(BoxBottom * 0.33));          // First control point
                    c2 = new Point(FadeInRightTop.X, Convert.ToInt32(BoxBottom * 0.66)); // Second control point
                    p2 = FadeInRightTop;                                                 // Endpoint
                    break;

                case CurveType.Slow:
                    // In Slow Curve
                    p1 = FadeInLeftBottom;                                              // Start point
                    c1 = new Point(Convert.ToInt32(FadeInRightTop.X * 0.5), BoxBottom); // First control point
                    c2 = new Point(FadeInRightTop.X, Convert.ToInt32(BoxBottom * 0.5)); // Second control point
                    p2 = FadeInRightTop;                                                // Endpoint
                    break;

                case CurveType.Smooth:
                    // In Smooth Curve
                    p1 = FadeInLeftBottom;                                               // Start point
                    c1 = new Point(Convert.ToInt32(FadeInRightTop.X * 0.66), BoxBottom); // First control point
                    c2 = new Point(Convert.ToInt32(FadeInRightTop.X * 0.33), BoxTop);    // Second control point
                    p2 = FadeInRightTop;                                                 // Endpoint
                    break;
                }
            }
            else // Out
            {
                switch (curve)
                {
                case CurveType.Fast:
                    // Out Fast Curve
                    p1 = FadeOutLeftTop;                                                     // Start point
                    c1 = new Point(FadeOutLeftTop.X, Convert.ToInt32(BoxBottom * 0.5));      // First control point
                    c2 = new Point(Convert.ToInt32(BoxRight - FadeLength * 0.5), BoxBottom); // Second control point
                    p2 = FadeOutRightBottom;                                                 // Endpoint
                    break;

                case CurveType.Linear:
                    // Out Linear Curve
                    p1 = FadeOutLeftTop;       // Start point
                    c1 = FadeOutLeftTop;       // First control point
                    c2 = FadeOutRightBottom;   // Second control point
                    p2 = FadeOutRightBottom;   // Endpoint
                    break;

                case CurveType.Sharp:
                    // Out Sharp Curve
                    p1 = FadeOutLeftTop;                                                 // Start point
                    c1 = new Point(FadeOutLeftTop.X, Convert.ToInt32(BoxBottom * 0.66)); // First control point
                    c2 = new Point(BoxRight, Convert.ToInt32(BoxBottom * 0.33));         // Second control point
                    p2 = new Point(BoxRight, BoxBottom);                                 // Endpoint
                    break;

                case CurveType.Slow:
                    // Out Slow Curve
                    p1 = FadeOutLeftTop;                                                          // Start point
                    c1 = new Point(FadeOutLeftTop.X + Convert.ToInt32(FadeLength * 0.5), BoxTop); // First control point
                    c2 = new Point(BoxRight, Convert.ToInt32(BoxBottom * 0.5));                   // Second control point
                    p2 = FadeOutRightBottom;                                                      // Endpoint
                    break;

                case CurveType.Smooth:
                    // Out Smooth Curve
                    p1 = FadeOutLeftTop;                                                              // Start point
                    c1 = new Point(FadeOutLeftTop.X + Convert.ToInt32(FadeLength * 0.66), BoxTop);    // First control point
                    c2 = new Point(FadeOutLeftTop.X + Convert.ToInt32(FadeLength * 0.33), BoxBottom); // Second control point
                    p2 = FadeOutRightBottom;                                                          // Endpoint
                    break;
                }
            }
            graphics.DrawBezier(Pen, p1, c1, c2, p2);
        }
예제 #2
0
        void DrawCurve(FadeIs fadeIs, CurveType curve, Graphics graphics)
        {
            Point p1 = new Point();
            Point c1 = new Point();
            Point c2 = new Point();
            Point p2 = new Point();

            if (fadeIs == FadeIs.Left)
            {
                switch (curve)
                {
                case CurveType.Slow:
                    // Left Slow Curve
                    p1 = new Point(1, 1);                                       // Start point
                    c1 = new Point(Convert.ToInt32(BoxRight * 0.5), 1);         // First control point
                    c2 = new Point(BoxRight, Convert.ToInt32(BoxBottom * 0.5)); // Second control point
                    p2 = new Point(BoxRight, BoxBottom);                        // Endpoint
                    break;

                case CurveType.Linear:
                    // Left Linear Curve
                    p1 = new Point(1, 1);                // Start point
                    c1 = new Point(1, 1);                // First control point
                    c2 = new Point(BoxRight, BoxBottom); // Second control point
                    p2 = new Point(BoxRight, BoxBottom); // Endpoint
                    break;

                case CurveType.Sharp:
                    // Left Sharp Curve
                    p1 = new Point(1, 1);                                        // Start point
                    c1 = new Point(1, Convert.ToInt32(BoxBottom * 0.66));        // First control point
                    c2 = new Point(BoxRight, Convert.ToInt32(BoxBottom * 0.33)); // Second control point
                    p2 = new Point(BoxRight, BoxBottom);                         // Endpoint
                    break;

                case CurveType.Fast:
                    // Left Fast Curve
                    p1 = new Point(1, 1);                                       // Start point
                    c1 = new Point(1, Convert.ToInt32(BoxBottom * 0.5));        // First control point
                    c2 = new Point(Convert.ToInt32(BoxRight * 0.5), BoxBottom); // Second control point
                    p2 = new Point(BoxRight, BoxBottom);                        // Endpoint
                    break;

                case CurveType.Smooth:
                    // Left Smooth Curve
                    p1 = new Point(1, 1);                                        // Start point
                    c1 = new Point(Convert.ToInt32(BoxRight * 0.66), 1);         // First control point
                    c2 = new Point(Convert.ToInt32(BoxRight * 0.33), BoxBottom); // Second control point
                    p2 = new Point(BoxRight, BoxBottom);                         // Endpoint
                    break;
                }
            }
            else // Right
            {
                switch (curve)
                {
                case CurveType.Slow:
                    // Right Fast Curve
                    p1 = new Point(1, BoxBottom);                               // Start point
                    c1 = new Point(Convert.ToInt32(BoxRight * 0.5), BoxBottom); // First control point
                    c2 = new Point(BoxRight, Convert.ToInt32(BoxBottom * 0.5)); // Second control point
                    p2 = new Point(BoxRight, 1);                                // Endpoint
                    break;

                case CurveType.Linear:
                    // Right Linear Curve
                    p1 = new Point(1, BoxBottom);     // Start point
                    c1 = new Point(1, BoxBottom);     // First control point
                    c2 = new Point(BoxRight, 1);      // Second control point
                    p2 = new Point(BoxRight, 1);      // Endpoint
                    break;

                case CurveType.Sharp:
                    // Right Sharp Curve
                    p1 = new Point(1, BoxBottom);                                // Start point
                    c1 = new Point(1, Convert.ToInt32(BoxBottom * 0.33));        // First control point
                    c2 = new Point(BoxRight, Convert.ToInt32(BoxBottom * 0.66)); // Second control point
                    p2 = new Point(BoxRight, 1);                                 // Endpoint
                    break;

                case CurveType.Fast:
                    // Right Slow Curve
                    p1 = new Point(1, BoxBottom);                        // Start point
                    c1 = new Point(1, Convert.ToInt32(BoxBottom * 0.5)); // First control point
                    c2 = new Point(Convert.ToInt32(BoxRight * 0.5), 1);  // Second control point
                    p2 = new Point(BoxRight, 1);                         // Endpoint
                    break;

                case CurveType.Smooth:
                    // Right Smooth Curve
                    p1 = new Point(1, BoxBottom);                                // Start point
                    c1 = new Point(Convert.ToInt32(BoxRight * 0.66), BoxBottom); // First control point
                    c2 = new Point(Convert.ToInt32(BoxRight * 0.33), 1);         // Second control point
                    p2 = new Point(BoxRight, 1);                                 // Endpoint
                    break;
                }
            }
            graphics.DrawBezier(Pen, p1, c1, c2, p2);
        }