public override void Initialize(ContentManager content, GraphicsDevice graphics) { texture = content.Load <Texture2D>(textureName); srcRect[0] = new Rectangle(0, 0, texture.Width - 1, texture.Height); srcRect[1] = new Rectangle(texture.Width - 1, 0, 1, texture.Height); srcRect[2] = new Rectangle(texture.Width - 1, 0, -texture.Width + 1, texture.Height); if (Text != string.Empty) { textSize = Font.MeasureString(Text); } if (textureName == @"textures\controls\button\default") { if (Size.X < Font.MeasureString(Text).X + 20f) { Size = new Vector2(Font.MeasureString(Text).X + 20f, Size.Y); } if (Size.Y < texture.Height) { Size = new Vector2(Size.X, texture.Height); } if (Size.Y < Font.MeasureString(Text).Y + 5f) { Size = new Vector2(Size.X, Font.MeasureString(Text).Y + 5f); } } else { srcRect[0].Width += 1; Size = new Vector2(texture.Width * scale, texture.Height * scale); } area.Width = (int)Size.X; area.Height = (int)Size.Y; Vector4 colorVect = BackColor.ToVector4(); highlight = BackColor; BackColor = new Color(new Vector4(colorVect.X * 0.95f, colorVect.Y * 0.95f, colorVect.Z * 0.95f, colorVect.W)); dimColor = new Color(new Vector4(colorVect.X * 0.85f, colorVect.Y * 0.85f, colorVect.Z * 0.85f, colorVect.W)); colorVect = ForeColor.ToVector4(); texthighlight = ForeColor; ForeColor = new Color(new Vector4(colorVect.X * 0.95f, colorVect.Y * 0.5f, colorVect.Z * 0.95f, colorVect.W)); textdim = new Color(new Vector4(colorVect.X * 0.9f, colorVect.Y * 0.9f, colorVect.Z * 0.9f, colorVect.W)); base.Initialize(content, graphics); }