コード例 #1
0
        /// <inheritdoc />
        protected override void InitializeShapes()
        {
            this.Shapes.Clear();
            double unit = this.Size.Width / (this.Maximum - this.Minimum);

            this.Shapes.Add(new Rectangle(this.WholeRectangle, this.Style.BorderThickness, this.Style.BorderColor, this.Style.BackColor, this.Style.Texture));
            var foreRectangle = new Microsoft.Xna.Framework.Rectangle(this.ScreenLocation.X, this.ScreenLocation.Y, (int)(unit * this.Value), (int)this.Size.Height);

            this.Shapes.Add(new Rectangle(foreRectangle, this.Style.BorderThickness, Color.Transparent, this.Style.ForeColor, this.Style.Texture));
        }
コード例 #2
0
 private void InitializeMembers()
 {
     base.Initialize();
     this.WholeRectangle = new Microsoft.Xna.Framework.Rectangle(this.ScreenLocation.X, this.ScreenLocation.Y, 120, 30);
     if (DefaultStyles.IsInitialized)
     {
         this.DefaultStyle = new Style(Color.White, null, 1, null, null, null, null, StyleType.Default);
         this.Style        = this.DefaultStyle;
         this.ActionStyle  = new Style(Color.White, Color.Blue, 1, null, null, null, null, StyleType.Action);
         this.ActiveStyle  = new Style(Color.White, Color.LightBlue, 1, null, null, null, null, StyleType.Active);
         this.Click       += (sender, e) => { Manager.KeyboardDispatcher.Receiver = this; };
         this.Update(new GameTime());
     }
 }
コード例 #3
0
        /// <inheritdoc />
        protected override void InitializeShapes()
        {
            this.Shapes.Clear();
            this.Shapes.Add(new Rectangle(this.WholeRectangle, 0, null, Color.Transparent, null));
            double unit = this.Size.Width / (this.Maximum - this.Minimum);

            this.thumbRectangle = new Microsoft.Xna.Framework.Rectangle(
                (int)(this.ScreenLocation.X + (this.Value * unit)) - (Slider.DefaultThumbWidth / 2),
                this.ScreenLocation.Y,
                Slider.DefaultThumbWidth,
                Slider.DefaultThumbHeight);
            this.Shapes.Add(new Rectangle(this.thumbRectangle, this.Style));
            var barRectangle = new Microsoft.Xna.Framework.Rectangle(
                this.ScreenLocation.X,
                (int)(this.ScreenLocation.Y + (this.Size.Height / 2)),
                (int)this.Size.Width,
                this.Style.BorderThickness);

            this.Shapes.Add(new Rectangle(barRectangle, 0, null, this.Style.ForeColor, null));
        }
コード例 #4
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 Rectangle(boxRectangle, this.Style);

            if (this.fill)
            {
                rectangle = new Rectangle(boxRectangle, this.Style);
                if (this.Style.StyleType == StyleType.Active && !this.Checked)
                {
                    this.fill = false;
                }
            }
            else
            {
                rectangle = new 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);
        }