All() публичный статический Метод

Erstellt einen Border mit gleichem Abstand auf allen vier Seiten.
public static All ( int value ) : Border
value int Wert für alle vier Seiten.
Результат Border
Пример #1
0
        public Textbox(IScreenManager manager, string style = "")
            : base(manager, style)
        {
            TextColor = Color.Black;
            TabStop   = true;
            CanFocus  = true;
            Padding   = Border.All(5);

            ApplySkin(typeof(Textbox));
        }
Пример #2
0
        /// <summary>
        /// Wird aufgerufen wenn ein neues Element zu "Pages" hinzugefügt wird, erstellt einen neuen Eintrag in der TabList
        /// </summary>
        private void OnInsert(TabPage item, int index)
        {
            Label title = new Label(Manager);

            title.Text            = item.Title;
            title.Padding         = Border.All(10);
            title.Background      = TabBrush;
            title.Margin          = new Border(0, 0, TabSpacing, 0);
            title.LeftMouseClick += (s, e) => SelectTab(Pages.IndexOf(item));
            title.CanFocus        = true;
            title.TabStop         = true;
            title.KeyDown        += (s, e) => {
                if (e.Key == Microsoft.Xna.Framework.Input.Keys.Enter && title.Focused == TreeState.Active)
                {
                    SelectTab(Pages.IndexOf(item));
                }
            };
            tabListStack.Controls.Add(title);

            SelectTab(SelectedTabIndex);
        }
Пример #3
0
        public Combobox(IScreenManager manager)
            : base(manager)
        {
            mainControl = new ContentControl(manager)
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                Margin  = Border.All(0),
                Padding = Border.All(0),
            };
            Children.Add(mainControl);

            Selector = new Listbox <T>(manager);
            Selector.HorizontalAlignment  = HorizontalAlignment.Left;
            Selector.VerticalAlignment    = VerticalAlignment.Top;
            Selector.MaxHeight            = 100;
            Selector.TemplateGenerator    = GenerateControl;
            Selector.SelectedItemBrush    = null;
            Selector.Background           = new BorderBrush(Color.White);
            Selector.SelectedItemChanged += Selector_SelectedItemChanged;

            ApplySkin(typeof(Combobox <T>));
        }
Пример #4
0
        public Skin(ContentManager content)
        {
            ControlSkins = new Dictionary <Type, Action <Control> >();
            StyleSkins   = new Dictionary <string, Action <Control> >();

            SplitterWidth   = 4;
            ScrollbarWidth  = 10;
            ScrollerMinSize = 10;

            BackgroundColor = new Color(20, 147, 73);
            LogoColorOrange = new Color(241, 145, 11);
            LogoColorRed    = new Color(225, 7, 22);

            TextColorBlack = new Color(0, 0, 0);
            TextColorGray  = new Color(86, 86, 86);
            TextColorWhite = new Color(255, 255, 255);

            HeadlineFont = content.Load <SpriteFont>("HeadlineFont");
            TextFont     = content.Load <SpriteFont>("GameFont");
            BoldFont     = content.Load <SpriteFont>("BoldFont");

            FocusFrameBrush = new BorderBrush(LineType.Dotted, Color.Black, 1);

            ButtonBrush        = new BorderBrush(Color.White, LineType.Solid, Color.LightGray, 1);
            ButtonHoverBrush   = new BorderBrush(Color.LightGray, LineType.Solid, Color.LightGray, 1);
            ButtonPressedBrush = new BorderBrush(Color.LightGray, LineType.Solid, Color.Black, 1);
            PanelBrush         = new BorderBrush(Color.White, LineType.Solid, Color.Black, 1);

            VerticalScrollBackgroundBrush   = new BorderBrush(Color.White, LineType.Solid, Color.Black, 1);
            HorizontalScrollBackgroundBrush = new BorderBrush(Color.White, LineType.Solid, Color.Black, 1);
            VerticalScrollForegroundBrush   = new BorderBrush(Color.LightGray, LineType.Solid, Color.Black, 1);
            HorizontalScrollForegroundBrush = new BorderBrush(Color.LightGray, LineType.Solid, Color.Black, 1);
            HorizontalSplitterBrush         = new BorderBrush(Color.White, LineType.Solid, Color.LightGray, 1);
            VerticalSplitterBrush           = new BorderBrush(Color.White, LineType.Solid, Color.LightGray, 1);

            ProgressBarBrush = new BorderBrush(Color.Blue, LineType.Solid, Color.Black, 1);

            SelectedItemBrush = new BorderBrush(Color.Red);

            // =============
            // Skin-Methoden
            // =============

            // Control
            ControlSkins.Add(typeof(Control), (c) =>
            {
                Control control             = c as Control;
                control.Margin              = Border.All(0);
                control.Padding             = Border.All(0);
                control.HorizontalAlignment = HorizontalAlignment.Center;
                control.VerticalAlignment   = VerticalAlignment.Center;
            });

            // Label
            ControlSkins.Add(typeof(Label), (c) =>
            {
                Label label = c as Label;
                label.VerticalTextAlignment   = VerticalAlignment.Center;
                label.HorizontalTextAlignment = HorizontalAlignment.Left;
                label.Font      = Current.TextFont;
                label.TextColor = Current.TextColorBlack;
                label.Padding   = Border.All(5);
            });

            // Button
            ControlSkins.Add(typeof(Button), (c) =>
            {
                Button button            = c as Button;
                button.Margin            = Border.All(2);
                button.Padding           = Border.All(5);
                button.Background        = Current.ButtonBrush;
                button.HoveredBackground = Current.ButtonHoverBrush;
                button.PressedBackground = Current.ButtonPressedBrush;
            });

            // Splitter
            ControlSkins.Add(typeof(Splitter), (c) =>
            {
                Splitter splitter                = c as Splitter;
                splitter.HorizontalAlignment     = HorizontalAlignment.Stretch;
                splitter.VerticalAlignment       = VerticalAlignment.Stretch;
                splitter.Orientation             = Orientation.Horizontal;
                splitter.SplitterSize            = Current.SplitterWidth;
                splitter.SplitterPosition        = 200;
                splitter.SplitterBrushHorizontal = Current.HorizontalSplitterBrush;
                splitter.SplitterBrushVertical   = Current.VerticalSplitterBrush;
            });

            // Scrollcontainer
            ControlSkins.Add(typeof(ScrollContainer), (c) =>
            {
                ScrollContainer scrollContainer = c as ScrollContainer;
                scrollContainer.HorizontalScrollbarBackground = Current.HorizontalScrollBackgroundBrush;
                scrollContainer.HorizontalScrollbarForeground = Current.HorizontalScrollForegroundBrush;
                scrollContainer.VerticalScrollbarBackground   = Current.VerticalScrollBackgroundBrush;
                scrollContainer.VerticalScrollbarForeground   = Current.VerticalScrollForegroundBrush;
                scrollContainer.ScrollbarWidth  = Current.ScrollbarWidth;
                scrollContainer.ScrollerMinSize = Current.ScrollerMinSize;
            });

            // StackPanel
            ControlSkins.Add(typeof(StackPanel), (c) =>
            {
                StackPanel stackPanel = c as StackPanel;
            });

            // ListControl
            ControlSkins.Add(typeof(ListControl <>), (c) =>
            {
                dynamic listControl           = c;
                listControl.SelectedItemBrush = Current.SelectedItemBrush;
            });

            // Listbox
            ControlSkins.Add(typeof(Listbox <>), (c) =>
            {
                dynamic listBox = c;
            });

            // Combobox
            ControlSkins.Add(typeof(Combobox <>), (c) =>
            {
                dynamic comboBox    = c;
                comboBox.Background = new BorderBrush(Color.White);
            });

            // Progressbar
            ControlSkins.Add(typeof(ProgressBar), (c) =>
            {
                ProgressBar progressBar = c as ProgressBar;
                progressBar.BarBrush    = Current.ProgressBarBrush;
            });

            //Slider
            ControlSkins.Add(typeof(Slider), (c) =>
            {
                Slider s                = c as Slider;
                s.Orientation           = Orientation.Horizontal;
                s.SliderBackgroundBrush = new BorderBrush(Color.LightGray);
                s.SliderForegroundBrush = new BorderBrush(Color.SlateGray);
                s.SliderWidth           = 20;
            });

            ControlSkins.Add(typeof(Checkbox), (c) =>
            {
                Checkbox checkbox      = c as Checkbox;
                checkbox.BoxBrush      = new BorderBrush(Color.Black);
                checkbox.InnerBoxBrush = new BorderBrush(Color.LightGray);
                checkbox.HookBrush     = new BorderBrush(Color.LawnGreen);
                checkbox.Width         = 20;
                checkbox.Height        = 20;
            });

            ControlSkins.Add(typeof(TabControl), (c) =>
            {
                TabControl tabControl        = c as TabControl;
                tabControl.TabBrush          = new BorderBrush(Color.LightGray);
                tabControl.TabActiveBrush    = new BorderBrush(Color.Gray);
                tabControl.TabPageBackground = new BorderBrush(Color.Gray);
                tabControl.TabSpacing        = 1;
            });
        }