Ejemplo n.º 1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Init(e);
            G.SmoothingMode     = SmoothingMode.AntiAlias;
            G.InterpolationMode = InterpolationMode.HighQualityBicubic;
            G.FillPath(B1, GP1);


            if (Checked)
            {
                G.FillPath(B2, GP2);
                G.FillPath(PGB1, GP2);
                G.DrawPath(Pens.Black, GP2);
                if (Hover)
                {
                    G.FillPath(LGB1, GP3);
                    G.DrawPath(Pens.Black, GP3);
                    G.DrawPath(P1, GP4);
                    G.DrawString("ON", new Font("Microsoft Sans Serif", 7, FontStyle.Bold), Brushes.Black, 7, 6);
                    G.DrawString("ON", new Font("Microsoft Sans Serif", 7, FontStyle.Bold), Brushes.White, 7, 7);
                }
                else
                {
                    G.FillPath(LGB1, GP3);
                    G.DrawPath(Pens.Black, GP3);
                    G.DrawPath(P1, GP4);
                    G.DrawString("ON", new Font("Microsoft Sans Serif", 7, FontStyle.Bold), Brushes.Black, 7, 6);
                    G.DrawString("ON", new Font("Microsoft Sans Serif", 7, FontStyle.Bold), Brushes.White, 7, 7);
                }
            }
            else
            {
                G.FillPath(B1, GP1);
                G.FillPath(B2, GP2);
                G.FillPath(PGB1, GP2);
                G.DrawPath(Pens.Black, GP2);
                if (Hover)
                {
                    G.FillPath(LGB3, GP5);
                    G.DrawPath(Pens.Black, GP5);
                    G.DrawPath(P2, GP6);
                    G.DrawString("OFF", new Font("Microsoft Sans Serif", 7, FontStyle.Bold), Brushes.Black, Width - 29, 6);
                    G.DrawString("OFF", new Font("Microsoft Sans Serif", 7, FontStyle.Bold), B3, Width - 29, 7);
                }
                else
                {
                    G.FillPath(LGB3, GP5);
                    G.DrawPath(Pens.Black, GP5);
                    G.DrawPath(P2, GP6);
                    G.DrawString("OFF", new Font("Microsoft Sans Serif", 7, FontStyle.Bold), Brushes.Black, Width - 29, 6);
                    G.DrawString("OFF", new Font("Microsoft Sans Serif", 7, FontStyle.Bold), B3, Width - 29, 7);
                }
            }
            cn.Dispose();
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            //#Zone " Declarations "
            List <Color> Colors1 = new List <Color>();
            List <Color> Colors2 = new List <Color>();

            C1 = Color.FromArgb(62, 62, 62);
            C2 = Color.FromArgb(1, 1, 1);

            G = e.Graphics;

            LGB1 = new LinearGradientBrush(new Point(0, 0), new Point(Width, 0), Color.Transparent, Color.Transparent);
            LGB2 = new LinearGradientBrush(new Point(0, 1), new Point(Width, 1), Color.Transparent, Color.Transparent);
            conObj.AddObjectRange(new LinearGradientBrush[] {
                LGB1,
                LGB2
            });

            CB1 = new ColorBlend();
            CB2 = new ColorBlend();
            //#End Zone

            //#Zone " Colors first line "
            for (int i = 0; i <= 255; i += 51)
            {
                Colors1.Add(Color.FromArgb(i, C1));
            }
            for (int i = 255; i >= 0; i += -51)
            {
                Colors1.Add(Color.FromArgb(i, C1));
            }
            //#End Zone

            //#Zone " Colors Second line "
            for (int i = 0; i <= 255; i += 51)
            {
                Colors2.Add(Color.FromArgb(i, C2));
            }
            for (int i = 255; i >= 0; i += -51)
            {
                Colors2.Add(Color.FromArgb(i, C2));
            }
            //#End Zone

            //#Zone " colorblend first line  "
            CB1.Colors    = Colors1.ToArray();
            CB1.Positions = new float[] {
                0.0f,
                0.08f,
                0.16f,
                0.24f,
                0.32f,
                0.4f,
                0.48f,
                0.56f,
                0.64f,
                0.72f,
                0.8f,
                1.0f
            };
            //#End Zone

            //#Zone " colorblend second line "
            CB2.Colors    = Colors2.ToArray();
            CB2.Positions = new float[] {
                0.0f,
                0.08f,
                0.16f,
                0.24f,
                0.32f,
                0.4f,
                0.48f,
                0.56f,
                0.64f,
                0.72f,
                0.8f,
                1.0f
            };
            //#End Zone

            //#Zone " Pen "
            LGB1.InterpolationColors = CB1;
            LGB2.InterpolationColors = CB2;

            P1 = new Pen(LGB1);
            P2 = new Pen(LGB2);
            conObj.AddObjectRange(new Pen[] {
                P1,
                P2
            });
            //#End Zone

            G.DrawLine(P1, 0, 0, Width, 0);
            G.DrawLine(P2, 0, 1, Width, 1);

            conObj.Dispose();
        }
Ejemplo n.º 3
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            //'#Zone " DebugMode "
#if DEBUG
            //Dim ST As New Stopwatch : ST.Start()
#endif

            //#End Zone

            Init(e);

            //#Zone " Draw background"
            G.FillPath(B1, GP1);
            //#End Zone

            //#Zone " Draw header "
            G.SetClip(GP2);
            G.FillRectangle(LGB1, R4);
            G.ResetClip();
            //#End Zone

            //#Zone " Draw title "
            G.DrawString(Text, new Font("Microsoft Sans Serif", 10, FontStyle.Regular), Brushes.White, 27, 22);
            //#End Zone

            //#Zone " Draw border "
            G.DrawPath(P1, GP1);
            G.DrawPath(P2, GP2);
            //#End Zone

            //#Zone " Mouse state "
            switch (MouseState)
            {
            case State.HoverClose:
                DrawControlBox_Close(G);
                break;

            case State.HoverMax:
                DrawControlBox_Max(G);
                break;

            case State.HoverMin:
                DrawControlBox_Min(G);
                break;

            case State.None:
                DrawControlBox(G);
                break;
            }
            //#End Zone

            //#Zone " Dispose all draw object "
            containerDisposable.Dispose();
            //#End Zone

            //#Zone " DebugMode "
#if DEBUG
            //Debug.WriteLine(ST.Elapsed.ToString)
#endif

            //#End Zone
        }