示例#1
0
        public MetroSetComboBox()
        {
            SetStyle
            (
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.UserPaint |
                ControlStyles.ResizeRedraw |
                ControlStyles.OptimizedDoubleBuffer |
                ControlStyles.SupportsTransparentBackColor,
                true);
            DoubleBuffered = true;
            UpdateStyles();
            Font             = MetroSetFonts.Regular(11);
            BackColor        = Color.Transparent;
            DrawMode         = DrawMode.OwnerDrawFixed;
            ItemHeight       = 20;
            DoubleBuffered   = true;
            _StartIndex      = 0;
            CausesValidation = false;
            AllowDrop        = true;
            DropDownStyle    = ComboBoxStyle.DropDownList;
            mth = new Methods();
            utl = new Utilites();

            ApplyTheme();
        }
示例#2
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);
                                }
                            }
                        }
                    }
                }
            }
        }
 /// <summary>
 /// The Constructor.
 /// </summary>
 public MetroSetMessageBox() : base()
 {
     Font          = MetroSetFonts.Regular(9.5f);
     ShowInTaskbar = false;
     StartPosition = FormStartPosition.CenterParent;
     buttonSize    = new Size(95, 32);
     ApplyTheme();
     EvaluateControls();
     AddControls();
     //HideControls();
 }
示例#4
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();
 }
 public MetroSetRichTextBox()
 {
     SetStyle(
         ControlStyles.AllPaintingInWmPaint |
         ControlStyles.ResizeRedraw |
         ControlStyles.OptimizedDoubleBuffer |
         ControlStyles.SupportsTransparentBackColor, true);
     DoubleBuffered = true;
     UpdateStyles();
     Font = MetroSetFonts.Regular(10);
     EvaluateVars();
     ApplyTheme();
     T_Defaults();
 }
示例#6
0
 public MetroSetTile()
 {
     SetStyle(
         ControlStyles.AllPaintingInWmPaint |
         ControlStyles.ResizeRedraw | ControlStyles.UserPaint |
         ControlStyles.OptimizedDoubleBuffer |
         ControlStyles.SupportsTransparentBackColor, true);
     DoubleBuffered = true;
     UpdateStyles();
     Font = MetroSetFonts.Light(10);
     utl  = new Utilites();
     mth  = new Methods();
     ApplyTheme();
 }
示例#7
0
 public MetroSetNumeric()
 {
     SetStyle(
         ControlStyles.ResizeRedraw |
         ControlStyles.OptimizedDoubleBuffer |
         ControlStyles.SupportsTransparentBackColor, true);
     DoubleBuffered = true;
     UpdateStyles();
     Font      = MetroSetFonts.SemiLight(10);
     BackColor = Color.Transparent;
     mth       = new Methods();
     utl       = new Utilites();
     ApplyTheme();
     point = new Point(0, 0);
 }
示例#8
0
 public MetroSetLink()
 {
     SetStyle(
         ControlStyles.ResizeRedraw |
         ControlStyles.OptimizedDoubleBuffer |
         ControlStyles.SupportsTransparentBackColor, true
         );
     DoubleBuffered = true;
     UpdateStyles();
     Cursor = Cursors.Hand;
     Font   = MetroSetFonts.Light(10);
     mth    = new Methods();
     utl    = new Utilites();
     style  = Style.Dark;
     ApplyTheme();
     LinkBehavior = LinkBehavior.HoverUnderline;
 }
示例#9
0
 public MetroSetTextBox()
 {
     SetStyle(
         ControlStyles.ResizeRedraw |
         ControlStyles.OptimizedDoubleBuffer |
         ControlStyles.SupportsTransparentBackColor, true);
     DoubleBuffered = true;
     UpdateStyles();
     Font = MetroSetFonts.Regular(10);
     EvaluateVars();
     ApplyTheme();
     T_Defaults();
     if (!Multiline)
     {
         Size = new Size(135, 30);
     }
 }
示例#10
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();
 }
示例#11
0
        private void OnDraw(object sender, DrawToolTipEventArgs e)
        {
            Graphics G = e.Graphics;

            G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
            Rectangle rect = new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Height - 1);

            using (SolidBrush BG = new SolidBrush(BackColor))
            {
                using (Pen Stroke = new Pen(BorderColor))
                {
                    using (SolidBrush TB = new SolidBrush(ForeColor))
                    {
                        G.FillRectangle(BG, rect);
                        G.DrawString(e.ToolTipText, MetroSetFonts.Light(11), TB, rect, mth.SetPosition());
                        G.DrawRectangle(Stroke, rect);
                    }
                }
            }
        }
示例#12
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();
 }
示例#13
0
 public MetroSetForm()
 {
     SetStyle(
         ControlStyles.UserPaint |
         ControlStyles.AllPaintingInWmPaint |
         ControlStyles.ResizeRedraw |
         ControlStyles.OptimizedDoubleBuffer |
         ControlStyles.ContainerControl |
         ControlStyles.SupportsTransparentBackColor, true);
     DoubleBuffered = true;
     UpdateStyles();
     Padding                    = new Padding(12, 70, 12, 12);
     FormBorderStyle            = FormBorderStyle.None;
     backgorundImageTrasparency = 0.90f;
     Font         = MetroSetFonts.SemiLight(13);
     mth          = new Methods();
     utl          = new Utilites();
     user32       = new User32();
     showLeftRect = true;
     showHeader   = false;
     ApplyTheme();
 }
示例#14
0
 protected MetroSetForm()
 {
     SetStyle(
         ControlStyles.UserPaint |
         ControlStyles.AllPaintingInWmPaint |
         ControlStyles.ResizeRedraw |
         ControlStyles.OptimizedDoubleBuffer |
         ControlStyles.ContainerControl |
         ControlStyles.SupportsTransparentBackColor, true);
     UpdateStyles();
     _mth            = new Methods();
     _utl            = new Utilites();
     _user32         = new User32();
     Padding         = new Padding(12, 70, 12, 12);
     FormBorderStyle = FormBorderStyle.None;
     _backgroundImageTransparency = 0.90f;
     base.Font        = MetroSetFonts.SemiLight(13);
     DropShadowEffect = true;
     _showLeftRect    = true;
     _showHeader      = false;
     AllowResize      = true;
     ApplyTheme();
 }
示例#15
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);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }