Artemis.Utilities.Keyboard.KeyboardRectangle.Draw C# (CSharp) Метод

Draw() публичный Метод

public Draw ( Graphics g ) : void
g System.Drawing.Graphics
Результат void
        public void Draw(Graphics g)
        {
            if (!Visible || Height < 1 || Width < 1 || !Colors.Any())
                return;

            var brush = CreateBrush();
            var baseRect = new Rectangle(X, Y, Width, Height);

            g.FillRectangle(brush, baseRect);
            if (!Rotate)
                return;

            _rotationProgress = _rotationProgress + LoopSpeed;
            if (ContainedBrush && _rotationProgress > Width)
                _rotationProgress = LoopSpeed;
            else if (!ContainedBrush && _rotationProgress > _keyboard.Width*Scale)
                _rotationProgress = LoopSpeed;
        }

Usage Example

Пример #1
0
 public void Draw(Graphics g)
 {
     var volumeRect = new KeyboardRectangle(_deviceManager.ActiveKeyboard, 0, 0, new List<Color>
     {
         ColorHelpers.ToDrawingColor(Settings.MainColor),
         ColorHelpers.ToDrawingColor(Settings.SecondaryColor)
     },
         LinearGradientMode.Horizontal)
     {
         Width = (int) (_deviceManager.ActiveKeyboard.Width*Scale/100.00*Volume),
         ContainedBrush = false
     };
     volumeRect.Draw(g);
 }