示例#1
0
        /// <inheritdoc />
        protected override void InitializeShapes()
        {
            this.Shapes.Clear();
            var textSize     = this.Style.Font.MeasureStringSize(this.textContent, this.Style.TextScale);
            var boxRectangle = new Microsoft.Xna.Framework.Rectangle().FromPointAndSize(
                this.ScreenLocation,
                new Size(CheckBox.DefaultBoxWidth, textSize.Height));
            var rectangle = new MonoForms.Shapes.Rectangle(boxRectangle, this.Style);

            if (this.fill)
            {
                rectangle = new MonoForms.Shapes.Rectangle(boxRectangle, this.Style);
                if (this.Style.StyleType == StyleType.Active && !this.Checked)
                {
                    this.fill = false;
                }
            }
            else
            {
                rectangle = new MonoForms.Shapes.Rectangle(
                    boxRectangle,
                    this.Style.BorderThickness,
                    this.Style.BorderColor,
                    Color.Transparent,
                    this.Style.Texture);
            }

            var textRectangle = boxRectangle.FromPointAndSize(new Point(boxRectangle.Right, boxRectangle.Top), textSize);

            this.text = new Text(
                this.textContent,
                this.Style.Font,
                this.Style.ForeColor,
                SpriteEffects.None,
                textRectangle);
            this.Shapes.Add(rectangle);
            this.Shapes.Add(this.text);
        }