示例#1
0
        /// <summary>
        /// Here we draw the container.
        /// </summary>
        /// <param name="e">PaintEventArgs</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            Graphics  G         = e.Graphics;
            Rectangle rect      = new Rectangle(0, 0, Width - 1, Height - 1);
            char      downArrow = '▼';

            G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;

            if (Enabled)
            {
                using (SolidBrush BG = new SolidBrush(BackgroundColor))
                {
                    using (Pen P = new Pen(BorderColor))
                    {
                        using (SolidBrush S = new SolidBrush(ArrowColor))
                        {
                            using (SolidBrush TB = new SolidBrush(ForeColor))
                            {
                                using (Font F = MetroSetFonts.SemiBold(8))
                                {
                                    G.FillRectangle(BG, rect);
                                    G.TextRenderingHint = TextRenderingHint.AntiAlias;
                                    G.DrawString(downArrow.ToString(), F, S, new Point(Width - 22, 8));
                                    G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
                                    G.DrawString(Text, F, TB, new Rectangle(7, 0, Width - 1, Height - 1), mth.SetPosition(StringAlignment.Near));
                                    G.DrawRectangle(P, rect);
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                using (SolidBrush BG = new SolidBrush(DisabledBackColor))
                {
                    using (Pen P = new Pen(DisabledBorderColor))
                    {
                        using (SolidBrush S = new SolidBrush(DisabledForeColor))
                        {
                            using (SolidBrush TB = new SolidBrush(DisabledForeColor))
                            {
                                using (Font F = MetroSetFonts.SemiBold(8))
                                {
                                    G.FillRectangle(BG, rect);
                                    G.TextRenderingHint = TextRenderingHint.AntiAlias;
                                    G.DrawString(downArrow.ToString(), F, S, new Point(Width - 22, 8));
                                    G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
                                    G.DrawString(Text, Font, TB, new Rectangle(7, 1, Width - 1, Height - 1), mth.SetPosition(StringAlignment.Near));
                                    G.DrawRectangle(P, rect);
                                }
                            }
                        }
                    }
                }
            }
        }
示例#2
0
 public MetroSetLabel()
 {
     SetStyle(
         ControlStyles.ResizeRedraw |
         ControlStyles.OptimizedDoubleBuffer |
         ControlStyles.SupportsTransparentBackColor, true);
     DoubleBuffered = true;
     UpdateStyles();
     Font = MetroSetFonts.SemiBold(10);
     mth  = new Methods();
     utl  = new Utilites();
     ApplyTheme();
 }
示例#3
0
 public MetroSetListBox()
 {
     SetStyle(
         ControlStyles.UserPaint |
         ControlStyles.AllPaintingInWmPaint |
         ControlStyles.Selectable |
         ControlStyles.ResizeRedraw |
         ControlStyles.OptimizedDoubleBuffer |
         ControlStyles.SupportsTransparentBackColor, true);
     DoubleBuffered = true;
     UpdateStyles();
     BackColor = Color.Transparent;
     Font      = MetroSetFonts.SemiBold(10);
     mth       = new Methods();
     utl       = new Utilites();
     ApplyTheme();
     SetDefaults();
 }
示例#4
0
 public MetroSetCheckBox()
 {
     SetStyle(
         ControlStyles.ResizeRedraw |
         ControlStyles.OptimizedDoubleBuffer |
         ControlStyles.SupportsTransparentBackColor, true);
     DoubleBuffered = true;
     UpdateStyles();
     Font      = MetroSetFonts.SemiBold(10);
     Cursor    = Cursors.Hand;
     BackColor = Color.Transparent;
     mth       = new Methods();
     utl       = new Utilites();
     timer     = new Timer()
     {
         Interval = 10,
         Enabled  = false
     };
     timer.Tick += SetCheckedChanged;
     ApplyTheme();
 }
示例#5
0
        protected override void OnPaint(PaintEventArgs e)
        {
            Graphics G = e.Graphics;

            G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
            Rectangle rect = new Rectangle(0, 0, Width - 1, Height - 1);

            char plus  = '+';
            char minus = '-';

            if (Enabled)
            {
                using (SolidBrush BG = new SolidBrush(BackColor))
                {
                    using (Pen P = new Pen(BorderColor))
                    {
                        using (SolidBrush S = new SolidBrush(SymbolsColor))
                        {
                            using (SolidBrush TB = new SolidBrush(ForeColor))
                            {
                                using (Font F2 = MetroSetFonts.SemiBold(18))
                                {
                                    using (StringFormat SF = new StringFormat {
                                        LineAlignment = StringAlignment.Center
                                    })
                                    {
                                        G.FillRectangle(BG, rect);
                                        G.DrawString(plus.ToString(), F2, S, new Rectangle(Width - 45, 1, 25, Height - 1), SF);
                                        G.DrawString(minus.ToString(), F2, S, new Rectangle(Width - 25, -1, 20, Height - 1), SF);
                                        G.DrawString(Value.ToString(), Font, TB, new Rectangle(0, 0, Width - 50, Height - 1), mth.SetPosition(StringAlignment.Far));
                                        G.DrawRectangle(P, rect);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                using (SolidBrush BG = new SolidBrush(DisabledBackColor))
                {
                    using (Pen P = new Pen(DisabledBorderColor))
                    {
                        using (SolidBrush S = new SolidBrush(DisabledForeColor))
                        {
                            using (SolidBrush TB = new SolidBrush(DisabledForeColor))
                            {
                                using (Font F2 = MetroSetFonts.SemiBold(18))
                                {
                                    using (StringFormat SF = new StringFormat {
                                        LineAlignment = StringAlignment.Center
                                    })
                                    {
                                        G.FillRectangle(BG, rect);
                                        G.DrawString(plus.ToString(), F2, S, new Rectangle(Width - 45, 1, 25, Height - 1), SF);
                                        G.DrawString(minus.ToString(), F2, S, new Rectangle(Width - 25, -1, 20, Height - 1), SF);
                                        G.DrawString(Value.ToString(), Font, TB, new Rectangle(0, 0, Width - 50, Height - 1), mth.SetPosition(StringAlignment.Far));
                                        G.DrawRectangle(P, rect);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }