示例#1
0
        protected internal override void OnThemeChange()
        {
            switch (CurrentButtonType)
            {
            case ButtonType.AddonSub:
            case ButtonType.ComboBoxSub:

                // Update fake sizes
                DynamicRectangle = ThemeManager.GetDynamicRectangle(this);
                var rectangle =
                    Enum.GetValues(typeof(States))
                    .Cast <States>()
                    .Select(state => DynamicRectangle.GetRectangle(state))
                    .FirstOrDefault(rect => !rect.IsEmpty);
                Size          = new Vector2(rectangle.Width, (int)(rectangle.Height * (CurrentButtonType == ButtonType.AddonSub ? 0.75f : 1)));
                SizeRectangle = new Rectangle(0, 0, (int)Size.X, (int)Size.Y);
                UpdateCropRectangle();

                // Update TextObject positions to current position
                TextObjects.ForEach(o => o.ApplyToControlPosition(this));
                break;

            default:

                // Update base theme
                base.OnThemeChange();
                break;
            }
        }
        protected internal override void OnThemeChange()
        {
            DynamicRectangle = ThemeManager.GetDynamicRectangle(this);
            var rectangle =
                Enum.GetValues(typeof(States))
                .Cast <States>()
                .Select(state => DynamicRectangle.GetRectangle(state))
                .FirstOrDefault(rect => !rect.IsEmpty);

            Size          = new Vector2(rectangle.Width, rectangle.Height);
            SizeRectangle = new Rectangle(0, 0, rectangle.Width, rectangle.Height);
            UpdateCropRectangle();

            // Update TextObject positions to current position
            TextObjects.ForEach(o => o.ApplyToControlPosition(this));
        }