コード例 #1
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            T1 = new Rectangle(1, 1, Width - 3, 18);

            Bitmap   B = new Bitmap(Width, Height);
            Graphics G = Graphics.FromImage(B);

            //Drawing
            G.Clear(C1);
            LinearGradientBrush G1 = new LinearGradientBrush(new Point(T1.X, T1.Y), new Point(T1.X, T1.Y + T1.Height), C3, C4);

            G.FillRectangle(G1, T1);
            G.DrawRectangle(ConversionFunctions.ToPen(C2), T1);
            G.DrawRectangle(ConversionFunctions.ToPen(C2), new Rectangle(T1.X, T1.Y + T1.Height + 2, T1.Width, Height - T1.Y - T1.Height - 4));

            G1.Dispose();

            G.DrawString(Text, Font, ConversionFunctions.ToBrush(113, 170, 186), new Rectangle(new Point(T1.X + 4, T1.Y), new Size(T1.Width - 40, T1.Height)), new StringFormat {
                LineAlignment = StringAlignment.Center
            });


            //Finish Up
            e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0);
            G.Dispose();
            B.Dispose();
        }
コード例 #2
0
        public void ReplaceItem(System.Object sender, System.Windows.Forms.DrawItemEventArgs e)
        {
            Graphics G  = e.Graphics;
            Color    C4 = Color.Empty;

            e.DrawBackground();
            try
            {
                if (e.State == DrawItemState.Selected && e.State == DrawItemState.Focus)
                {
                    G.FillRectangle(ConversionFunctions.ToBrush(50, 80, 120), new Rectangle(e.Bounds.X - 1, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height + 2));
                    G.DrawRectangle(new Pen(ConversionFunctions.ToBrush(180, Color.Black), 1), new Rectangle(e.Bounds.X - 1, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height + 2));
                    C4 = Color.FromArgb(100, 165, 185);
                }
                else
                {
                    G.FillRectangle(ConversionFunctions.ToBrush(62, 60, 58), new Rectangle(e.Bounds.X - 1, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height + 2));
                    C4 = Color.FromArgb(200, 200, 200);
                }

                G.DrawString(base.GetItemText(base.Items[e.Index]), e.Font, ConversionFunctions.ToBrush(C4), e.Bounds, new StringFormat
                {
                    LineAlignment = StringAlignment.Center,
                    Alignment     = StringAlignment.Center
                });
            }
            catch
            {
            }
        }
コード例 #3
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            Bitmap              B  = new Bitmap(Width, Height);
            Graphics            G  = Graphics.FromImage(B);
            LinearGradientBrush G1 = new LinearGradientBrush(new Point(0, 0), new Point(0, Height), C3, C4);

            G.FillRectangle(G1, ClientRectangle);
            G1.Dispose();
            G.SmoothingMode = SmoothingMode.HighQuality;
            switch (State)
            {
            case MouseState.None:
                G.DrawEllipse(new Pen(C1, 2), new Rectangle(2, 2, Width - 5, Height - 5));
                break;

            case MouseState.Over:
                G.DrawEllipse(new Pen(C2, 2), new Rectangle(2, 2, Width - 5, Height - 5));
                break;

            case MouseState.Down:
                G.DrawEllipse(new Pen(CD, 2), new Rectangle(2, 2, Width - 5, Height - 5));
                break;
            }

            G.FillEllipse(ConversionFunctions.ToBrush(C2), new Rectangle(5, 5, Width - 11, Height - 11));

            e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0);
            G.Dispose();
            B.Dispose();
        }
コード例 #4
0
        protected override void OnPaint(PaintEventArgs e)
        {
            Bitmap   B = new Bitmap(Width, Height);
            Graphics G = Graphics.FromImage(B);

            try
            {
                SelectedTab.BackColor = C1;
            }
            catch
            {
            }
            G.Clear(Parent.BackColor);
            for (int i = 0; i <= TabCount - 1; i++)
            {
                if (!(i == SelectedIndex))
                {
                    Rectangle           x2 = new Rectangle(GetTabRect(i).X, GetTabRect(i).Y + 3, GetTabRect(i).Width + 2, GetTabRect(i).Height);
                    LinearGradientBrush G1 = new LinearGradientBrush(new Point(x2.X, x2.Y), new Point(x2.X, x2.Y + x2.Height), Color.FromArgb(60, 59, 58), Color.FromArgb(69, 69, 70));
                    G.FillRectangle(G1, x2);
                    G1.Dispose();
                    G.DrawRectangle(ConversionFunctions.ToPen(C3), x2);
                    G.DrawRectangle(ConversionFunctions.ToPen(C2), new Rectangle(x2.X + 1, x2.Y + 1, x2.Width - 2, x2.Height));
                    G.DrawString(TabPages[i].Text, Font, ConversionFunctions.ToBrush(130, 176, 190), x2, new StringFormat
                    {
                        LineAlignment = StringAlignment.Center,
                        Alignment     = StringAlignment.Center
                    });
                }
            }

            G.FillRectangle(ConversionFunctions.ToBrush(C1), 0, ItemSize.Height, Width, Height);
            G.DrawRectangle(ConversionFunctions.ToPen(C2), 0, ItemSize.Height, Width - 1, Height - ItemSize.Height - 1);
            G.DrawRectangle(ConversionFunctions.ToPen(C3), 1, ItemSize.Height + 1, Width - 3, Height - ItemSize.Height - 3);
            if (!(SelectedIndex == -1))
            {
                Rectangle x1 = new Rectangle(GetTabRect(SelectedIndex).X - 2, GetTabRect(SelectedIndex).Y, GetTabRect(SelectedIndex).Width + 3, GetTabRect(SelectedIndex).Height);
                G.FillRectangle(ConversionFunctions.ToBrush(C1), new Rectangle(x1.X + 2, x1.Y + 2, x1.Width - 2, x1.Height));
                G.DrawLine(ConversionFunctions.ToPen(C2), new Point(x1.X, x1.Y + x1.Height - 2), new Point(x1.X, x1.Y));
                G.DrawLine(ConversionFunctions.ToPen(C2), new Point(x1.X, x1.Y), new Point(x1.X + x1.Width, x1.Y));
                G.DrawLine(ConversionFunctions.ToPen(C2), new Point(x1.X + x1.Width, x1.Y), new Point(x1.X + x1.Width, x1.Y + x1.Height - 2));

                G.DrawLine(ConversionFunctions.ToPen(C3), new Point(x1.X + 1, x1.Y + x1.Height - 1), new Point(x1.X + 1, x1.Y + 1));
                G.DrawLine(ConversionFunctions.ToPen(C3), new Point(x1.X + 1, x1.Y + 1), new Point(x1.X + x1.Width - 1, x1.Y + 1));
                G.DrawLine(ConversionFunctions.ToPen(C3), new Point(x1.X + x1.Width - 1, x1.Y + 1), new Point(x1.X + x1.Width - 1, x1.Y + x1.Height - 1));

                G.DrawString(TabPages[SelectedIndex].Text, Font, ConversionFunctions.ToBrush(130, 176, 190), x1, new StringFormat
                {
                    LineAlignment = StringAlignment.Center,
                    Alignment     = StringAlignment.Center
                });
            }

            e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0);
            G.Dispose();
            B.Dispose();
        }
コード例 #5
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            Bitmap   B = new Bitmap(Width, Height);
            Graphics G = Graphics.FromImage(B);

            G.Clear(Parent.BackColor);

            switch (Enabled)
            {
            case true:
                switch (State)
                {
                case MouseState.None:
                    C2 = Color.FromArgb(70, 70, 70);
                    C3 = Color.FromArgb(54, 54, 51);
                    C4 = Color.FromArgb(152, 182, 192);
                    break;

                case MouseState.Down:
                    C2 = Color.FromArgb(54, 54, 51);
                    C3 = Color.FromArgb(70, 70, 70);
                    C4 = Color.FromArgb(112, 142, 152);
                    break;
                }
                break;

            case false:
                C2 = Color.FromArgb(70, 70, 70);
                C3 = Color.FromArgb(54, 54, 51);
                C4 = Color.FromArgb(89, 88, 88);
                break;
            }

            Rectangle           radRec = new Rectangle(0, 0, Height - 1, Height - 1);
            LinearGradientBrush B1     = new LinearGradientBrush(new Point(radRec.X + radRec.Width / 2, radRec.Y), new Point(radRec.X + radRec.Width / 2, radRec.Y + radRec.Height), C2, C3);

            G.SmoothingMode = SmoothingMode.HighQuality;
            G.FillEllipse(B1, radRec);
            G.DrawEllipse(new Pen(ConversionFunctions.ToBrush(C1)), radRec);
            if (Checked)
            {
                G.FillEllipse(ConversionFunctions.ToBrush(C4), new Rectangle(radRec.X + radRec.Width / 4, radRec.Y + radRec.Height / 4, radRec.Width / 2, radRec.Height / 2));
            }
            G.DrawString(Text, Font, ConversionFunctions.ToBrush(C4), new Rectangle(radRec.X + radRec.Width + 5, 0, Width - radRec.X - radRec.Width - 5, Height), new StringFormat
            {
                LineAlignment = StringAlignment.Center,
                Alignment     = StringAlignment.Near
            });


            e.Graphics.DrawImage(B, 0, 0);
            G.Dispose();
            B.Dispose();
        }
コード例 #6
0
        protected override void OnPaint(PaintEventArgs e)
        {
            if (!(DropDownStyle == ComboBoxStyle.DropDownList))
            {
                DropDownStyle = ComboBoxStyle.DropDownList;
            }
            Bitmap   B = new Bitmap(Width, Height);
            Graphics G = Graphics.FromImage(B);

            G.Clear(C3);


            int S1 = (int)G.MeasureString("...", Font).Height;

            if (SelectedIndex != -1)
            {
                G.DrawString(Items[SelectedIndex].ToString(), Font, ConversionFunctions.ToBrush(152, 182, 192), 4, Height / 2 - S1 / 2);
            }
            else
            {
                if ((Items != null) & Items.Count > 0)
                {
                    G.DrawString(Items[0].ToString(), Font, ConversionFunctions.ToBrush(152, 182, 192), 4, Height / 2 - S1 / 2);
                }
                else
                {
                    G.DrawString("...", Font, ConversionFunctions.ToBrush(152, 182, 192), 4, Height / 2 - S1 / 2);
                }
            }

            LinearGradientBrush G1 = new LinearGradientBrush(new Point(Width - 30, Height / 2), new Point(Width - 22, Height / 2), Color.Transparent, C3);

            G.FillRectangle(G1, Width - 30, 0, 8, Height);

            G.DrawRectangle(ConversionFunctions.ToPen(C1), new Rectangle(0, 0, Width - 1, Height - 1));
            G.DrawLine(ConversionFunctions.ToPen(C1), new Point(Width - 21, 0), new Point(Width - 21, Height));

            G.DrawRectangle(ConversionFunctions.ToPen(C2), 1, 1, Width - 23, Height - 3);

            G.FillRectangle(ConversionFunctions.ToBrush(C3), Width - 20, 1, 18, Height - 3);
            G.FillRectangle(ConversionFunctions.ToBrush(10, Color.White), Width - 20, 1, 18, Height - 3);
            G.DrawRectangle(ConversionFunctions.ToPen(C2), Width - 20, 1, 18, Height - 3);

            G.FillPolygon(Brushes.Black, Shapes.Triangle(new Point(Width - 12, Height / 2), new Size(5, 3)));
            G.FillPolygon(Brushes.LightBlue, Shapes.Triangle(new Point(Width - 13, Height / 2 - 1), new Size(5, 3)));

            e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0);
            G.Dispose();
            B.Dispose();
        }
コード例 #7
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            Bitmap   B = new Bitmap(Width, Height);
            Graphics G = Graphics.FromImage(B);

            LinearGradientBrush G1 = new LinearGradientBrush(new Point(0, 0), new Point(0, Height), C3, C4);

            G.FillRectangle(G1, 0, 0, Width, Height);
            G1.Dispose();

            if (Enabled)
            {
                switch (State)
                {
                case MouseState.Over:
                    G.FillRectangle(new SolidBrush(Color.FromArgb(20, Color.White)), new Rectangle(0, 0, Width, Height));
                    break;

                case MouseState.Down:
                    G.FillRectangle(new SolidBrush(Color.FromArgb(10, Color.Black)), new Rectangle(0, 0, Width, Height));
                    break;
                }
            }

            StringFormat S1 = new StringFormat();

            S1.LineAlignment = StringAlignment.Center;
            S1.Alignment     = StringAlignment.Center;

            switch (Enabled)
            {
            case true:
                G.DrawString(Text, Font, ConversionFunctions.ToBrush(113, 170, 186), new Rectangle(0, 0, Width - 1, Height - 1), S1);
                break;

            case false:
                G.DrawString(Text, Font, Brushes.Gray, new Rectangle(0, 0, Width - 1, Height - 1), S1);
                break;
            }

            S1.Dispose();

            G.DrawRectangle(ConversionFunctions.ToPen(C1), 0, 0, Width - 1, Height - 1);
            G.DrawRectangle(ConversionFunctions.ToPen(C2), 1, 1, Width - 3, Height - 3);

            e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0);
            G.Dispose();
            B.Dispose();
        }
コード例 #8
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            Bitmap    B    = new Bitmap(Width, Height);
            Graphics  G    = Graphics.FromImage(B);
            Rectangle Fill = new Rectangle(3, 3, Convert.ToInt32((Width - 7) * (val / max)), Height - 7);

            G.Clear(C5);

            LinearGradientBrush G1 = new LinearGradientBrush(new Point(0, 0), new Point(0, Height), C3, C4);

            G.FillRectangle(G1, Fill);
            G1.Dispose();
            G.DrawRectangle(ConversionFunctions.ToPen(C2), Fill);

            G.DrawRectangle(ConversionFunctions.ToPen(C1), 0, 0, Width - 1, Height - 1);
            G.DrawRectangle(ConversionFunctions.ToPen(C2), 1, 1, Width - 3, Height - 3);

            e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0);
            G.Dispose();
            B.Dispose();
        }
コード例 #9
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            Bitmap   B = new Bitmap(Width, Height);
            Graphics G = Graphics.FromImage(B);

            switch (Align)
            {
            case Alignment.Horizontal:
                G.DrawLine(ConversionFunctions.ToPen(C1), new Point(0, Height / 2), new Point(Width, Height / 2));
                G.DrawLine(ConversionFunctions.ToPen(C2), new Point(0, Height / 2 + 1), new Point(Width, Height / 2 + 1));
                break;

            case Alignment.Vertical:
                G.DrawLine(ConversionFunctions.ToPen(C1), new Point(Width / 2, 0), new Point(Width / 2, Height));
                G.DrawLine(ConversionFunctions.ToPen(C2), new Point(Width / 2 + 1, 0), new Point(Width / 2 + 1, Height));
                break;
            }

            e.Graphics.DrawImage(B, 0, 0);
            G.Dispose();
            B.Dispose();
        }
コード例 #10
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            Bitmap   B = new Bitmap(Width, Height);
            Graphics G = Graphics.FromImage(B);

            G.Clear(Parent.BackColor);
            C3 = Color.FromArgb(70, 69, 68);
            C4 = Color.FromArgb(64, 60, 59);
            switch (Enabled)
            {
            case true:
                switch (State)
                {
                case MouseState.Down:
                    C5 = Color.FromArgb(121, 151, 160);
                    C3 = Color.FromArgb(64, 60, 59);
                    C4 = Color.FromArgb(70, 69, 68);
                    break;

                case MouseState.None:
                    C5 = Color.FromArgb(151, 181, 190);
                    break;
                }
                break;

            case false:
                C5 = Color.FromArgb(88, 88, 88);
                break;
            }

            Rectangle           chkRec = new Rectangle(0, 0, Height - 1, Height - 1);
            LinearGradientBrush G1     = new LinearGradientBrush(new Point(chkRec.X, chkRec.Y), new Point(chkRec.X, chkRec.Y + chkRec.Height), C3, C4);

            G.FillRectangle(G1, chkRec);
            G1.Dispose();
            G.DrawRectangle(ConversionFunctions.ToPen(C1), chkRec);
            G.DrawRectangle(ConversionFunctions.ToPen(C2), new Rectangle(chkRec.X + 1, chkRec.Y + 1, chkRec.Width - 2, chkRec.Height - 2));
            Rectangle chkPoly = new Rectangle(chkRec.X + chkRec.Width / 4, chkRec.Y + chkRec.Height / 4, chkRec.Width / 2, chkRec.Height / 2);

            Point[] Poly =
            {
                new Point(chkPoly.X,                     chkPoly.Y + chkPoly.Height / 2),
                new Point(chkPoly.X + chkPoly.Width / 2, chkPoly.Y + chkPoly.Height),
                new Point(chkPoly.X + chkPoly.Width,     chkPoly.Y)
            };

            if (Checked)
            {
                G.SmoothingMode = SmoothingMode.HighQuality;
                Pen P1 = new Pen(ConversionFunctions.ToBrush(C5), 2);
                for (int i = 0; i <= Poly.Length - 2; i++)
                {
                    G.DrawLine(P1, Poly[i], Poly[i + 1]);
                }
            }
            G.DrawString(Text, Font, ConversionFunctions.ToBrush(C5), new Rectangle(chkRec.X + chkRec.Width + 5, 0, Width - chkRec.X - chkRec.Width - 5, Height), new StringFormat
            {
                LineAlignment = StringAlignment.Center,
                Alignment     = StringAlignment.Near
            });

            e.Graphics.DrawImage(B, 0, 0);
            G.Dispose();
            B.Dispose();
        }