예제 #1
0
        public ToogleButton()
        {
            _colors          = new ToogleButtonColors();
            _backgroundBrush = BrushCreator.CreateSolidBrush(_colors.Bg);
            _dotBrush        = BrushCreator.CreateSolidBrush(_colors.Dot);
            _borderPen       = PenCreator.Create(_colors.Border);


            DoubleBuffered = true;
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);

            ComputeDotPosition();
        }
예제 #2
0
        public ProgressBar()
        {
            DoubleBuffered = true;
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);

            pen          = PenCreator.Create("#0");
            pen.StartCap = System.Drawing.Drawing2D.LineCap.Round;
            pen.EndCap   = System.Drawing.Drawing2D.LineCap.Round;

            MinValue = 0;
            MaxValue = 100;
            Height   = 5;
        }
예제 #3
0
        public TrackBar() : base()
        {
            maxValue = 100;
            minValue = 0;
            value    = 0;

            DoubleBuffered = true;
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);

            //
            trackBgPen          = PenCreator.Create(Color.Black, BAR_HEIGHT);
            trackBgPen.StartCap = System.Drawing.Drawing2D.LineCap.Round;
            trackBgPen.EndCap   = System.Drawing.Drawing2D.LineCap.Round;

            trackValuePen          = PenCreator.Create(Color.Black, BAR_HEIGHT);
            trackValuePen.StartCap = System.Drawing.Drawing2D.LineCap.Round;
            trackValuePen.EndCap   = System.Drawing.Drawing2D.LineCap.Round;

            dotBrush = BrushCreator.CreateSolidBrush();
        }
예제 #4
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            var g = e.Graphics;

            g.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;

            string bgColor     = null;
            string textColor   = null;
            string borderColor = null;

            borderColor = SmallNofiticationColors.Border;
            if (_notifyType == NotifyType.Information)
            {
                bgColor   = SmallNofiticationColors.InformationBackground;
                textColor = SmallNofiticationColors.InformationText;
            }
            else if (_notifyType == NotifyType.Warning)
            {
                bgColor   = SmallNofiticationColors.WarningBackground;
                textColor = SmallNofiticationColors.WarningText;
            }
            else
            {
                bgColor   = SmallNofiticationColors.DangerBackground;
                textColor = SmallNofiticationColors.DangerText;
            }

            // background
            g.FillRectangle(BrushCreator.CreateSolidBrush(bgColor), ClientRectangle);
            // border
            g.DrawRectangle(PenCreator.Create(borderColor),
                            new Rectangle(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width - 1, ClientRectangle.Height - 1));
            // content
            g.DrawImage(notifyImages[_notifyType], _iconBounds);
            TextRenderer.DrawText(e.Graphics, this.Title, _titleFont, _titleBounds, ExColorTranslator.Get(textColor), TextFormatFlags.NoPadding);
            TextRenderer.DrawText(e.Graphics, this.Text, this.Font, _textBounds, ExColorTranslator.Get(textColor), TextFormatFlags.WordBreak | TextFormatFlags.NoPadding);
        }