示例#1
0
 public override string ToString()
 {
     return
         (FieldToSet == null
         ? base.ToString()
         : FieldToSet.Value + " = " + (ClearValue ? "(null)" : ValueToSet?.ToString()));
 }
示例#2
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaint(e);
            Graphics   G     = e.Graphics;
            HatchBrush Hatch = new HatchBrush(HatchStyle.WideDownwardDiagonal, Color.FromArgb(20, Color.Black), Color.Transparent);

            G.Clear(Parent.BackColor);
            G.SmoothingMode = SmoothingMode.AntiAlias;

            PipeBorder = RoundRectangle.RoundRect(1, 6, Width - 3, 8, 3);

            try
            {
                ValueDrawer = Convert.ToInt32((_Value - _Minimum) / (_Maximum - _Minimum) * (Width - 11));
            }
            catch (Exception ex)
            {
            }

            TrackBarHandleRect = new Rectangle(ValueDrawer, 0, 10, 20);

            G.SetClip(PipeBorder); // Set the clipping region of this Graphics to the specified GraphicsPath

            ValueRect = new Rectangle(1, 7, TrackBarHandleRect.X + TrackBarHandleRect.Width - 2, 7);
            VlaueLGB  = new LinearGradientBrush(ValueRect, _ValueColour, _ValueColour, 90.0F);

            G.FillRectangle(VlaueLGB, ValueRect);

            if (_DrawHatch == true)
            {
                G.FillRectangle(Hatch, ValueRect);
            }

            G.ResetClip(); // Reset the clip region of this Graphics to an infinite region

            G.SmoothingMode = SmoothingMode.AntiAlias;
            G.DrawPath(new Pen(Color.FromArgb(180, 180, 180)), PipeBorder); // Draw pipe border

            TrackBarHandle    = RoundRectangle.RoundRect(TrackBarHandleRect, 3);
            TrackBarHandleLGB = new LinearGradientBrush(ClientRectangle, SystemColors.Control, SystemColors.Control, 90.0F);

            // Fill the handle body with the specified color gradient
            G.FillPath(TrackBarHandleLGB, TrackBarHandle);
            // Draw handle borders
            G.DrawPath(new Pen(Color.FromArgb(180, 180, 180)), TrackBarHandle);

            if (_DrawValueString == true)
            {
                G.DrawString(ValueToSet.ToString(), Font, Brushes.Gray, 0, 25);
            }
        }