Example #1
0
        /// <summary>
        /// Draws the button.
        /// </summary>
        public override void Draw()
        {
            isMouseOverThis = Root.IsMouseOver(Rectangle);
            bool  pressed          = isMouseOverThis && Root.Mouse_NewState.LeftButton == ButtonState.Pressed;
            Color outerBorderColor = isMouseOverThis ? Skin.OuterBorderColorMouseOver : (this.IsActive ? Skin.InnerBorderColorMouseOver : Skin.OuterBorderColor);
            Color innerBorderColor = pressed ? Skin.InnerBorderColorMousePressed : (isMouseOverThis || this.IsActive ? Skin.InnerBorderColorMouseOver : Skin.InnerBorderColor);
            Color innerButtonColor = isMouseOverThis ? Skin.GreyBackgroundColorMouseOver: Skin.GreyBackgroundColor;
            Color textColor        = isMouseOverThis ? Skin.TextColorMouseOver : Skin.TextColor;

            Primitives.FillRectangle(Rectangle, innerBorderColor);
            Primitives.DrawRectangle(Rectangle, outerBorderColor, Skin.OuterBorderThickness);
            Primitives.DrawAndFillRectangle(InnerRectangleWithBorder, innerButtonColor, outerBorderColor, Skin.OuterBorderThickness);

            Primitives.DrawMultiLineText(Caption, AlignRight ? InnerRectangle.Extend(-4, 0) : InnerRectangle, textColor, FontFamily.Normal, AlignRight ? Primitives.TextAlignment.Right : Primitives.TextAlignment.Middle);
        }
 public void SetMargin(Margin margin)
 {
     InnerRectangle = InnerRectangle.ApplyMargins(margin);
     Empty          = Empty.ApplyMargins(margin);
 }
 private double Area(double size)
 {
     return(InnerRectangle.Area() * size / Size);
 }