当前位置: 首页>>代码示例>>C#>>正文


C# UIButton.AddDecoration方法代码示例

本文整理汇总了C#中UIButton.AddDecoration方法的典型用法代码示例。如果您正苦于以下问题:C# UIButton.AddDecoration方法的具体用法?C# UIButton.AddDecoration怎么用?C# UIButton.AddDecoration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIButton的用法示例。


在下文中一共展示了UIButton.AddDecoration方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetMenuEntry

        private UIControl GetMenuEntry( UIControl parent, string label )
        {
            var control = new UIButton();
            control.InputReleased += control_InputPressed;
            //var uiImg = new UIImage( "graphics/arrow_down" );
            //uiImg.AddConstraint( Edge.CenterXY, control, Edge.CenterXY );
            //control.AddDecoration( uiImg );

            var uiLabel = new UILabel( label );
            uiLabel.AddConstraint( Edge.CenterXY, control, Edge.CenterXY );
            control.AddDecoration( uiLabel );

            control.AddConstraint( Edge.CenterX, parent, Edge.CenterX );

            if( previousEntry == null )
            {
                control.AddConstraint( Edge.CenterY, parent, Edge.CenterY, 0, ConstraintCategory.Initialization );
            }
            else
            {
                control.AddConstraint( Edge.Top, previousEntry, Edge.Bottom, -20, ConstraintCategory.Initialization );
            }

            previousEntry = control;
            return control;
        }
开发者ID:adamxi,项目名称:SharpDXFramework,代码行数:26,代码来源:Menu.cs

示例2: GetMenuEntry

        private UIControl GetMenuEntry(UIControl parent, string label)
        {
            var btn = new UIButton();
            btn.Tag = label;
            btn.AddDecoration(new UILabel(label));

            btn.AddConstraint(Edge.CenterX, parent, Edge.CenterX, ConstraintCategory.All);

            if (previousEntry != null)
            {
                btn.AddConstraint(Edge.Top, previousEntry, Edge.Bottom, -20, ConstraintCategory.All);
            }

            previousEntry = btn;
            return btn;
        }
开发者ID:adamxi,项目名称:SharpDXFramework,代码行数:16,代码来源:MainTestScene.cs

示例3: LoadContent

        public override void LoadContent()
        {
            var menuBar = new UIPanel();
            menuBar.AddConstraint(Edge.Top, null, Edge.Top, 10);
            menuBar.AddConstraint(Edge.Left, null, Edge.Left, 50);
            menuBar.Alpha = 0f;

            var homeItem = new UIButton();
            homeItem.AddDecoration(new UILabel("Home Menu"));
            homeItem.AddConstraint(Edge.Left, menuBar, Edge.Left);
            homeItem.AddConstraint(Edge.CenterY, menuBar, Edge.CenterY);
            homeItem.InputReleased += HomeItem_InputReleased;
            menuBar.AddChild(homeItem);

            var debugCheckbox = new UILabelCheckBox("Draw UI Borders:");
            debugCheckbox.AddConstraint(Edge.Left, homeItem, Edge.Right, -20);
            debugCheckbox.AddConstraint(Edge.CenterY, menuBar, Edge.CenterY);
            debugCheckbox.CheckBox.InputReleased += DebugCheckbox_InputReleased;
            debugCheckbox.CheckBox.Checked = UIManager.DrawDebug;
            menuBar.AddChild(debugCheckbox);

            testSceneUIManager = new UIManager();
            testSceneUIManager.Add(menuBar);
        }
开发者ID:adamxi,项目名称:SharpDXFramework,代码行数:24,代码来源:TestScene.cs

示例4: UIScrollBar

        public UIScrollBar(ScrollBarOrientation orientation = ScrollBarOrientation.Vertical)
        {
            Orientation = orientation;
            string arrowResource = string.Empty;
            Vector2 sliderSize = Vector2.Zero;

            switch (orientation)
            {
                case ScrollBarOrientation.Vertical:
                    sliderSize = new Vector2(0, 20);
                    arrowResource = "graphics/arrow_down";
                    break;

                case ScrollBarOrientation.Horizontal:
                    sliderSize = new Vector2(20, 0);
                    arrowResource = "graphics/arrow_left";
                    break;
            }

            AutoSize = false;
            scrollStep = 0.02f;
            Color = new Color(240, 240, 240);
            Alpha = 1f;
            DrawBounds = true;

            sliderBackground = new UIPanel();
            sliderBackground.Color = new Color(240, 240, 240);
            sliderBackground.Alpha = 1f;
            sliderBackground.InputMoved += sliderBackground_MouseMoved;
            sliderBackground.InputPressed += sliderBackground_MousePressed;

            slider = new UIPanel();
            slider.Color = new Color(205, 205, 205);
            slider.Alpha = 1f;
            slider.AutoSize = false;
            slider.AbsorbPointer = false;
            slider.Size = sliderSize;
            //slider.InputDown += sliderBackground_MousePressed;

            arrowA = new UIButton();
            var arrowAImg = new UIImage(arrowResource);
            arrowAImg.Color = new Color(96, 96, 96);
            arrowAImg.AddConstraint(Edge.Dock, arrowA, Edge.Dock);
            arrowA.Tag = "bla";
            arrowA.AddDecoration(arrowAImg);
            arrowA.PointedColor = new Color(190, 190, 190);
            arrowA.PressedColor = new Color(120, 120, 120);
            arrowA.HighlightZoom = false;
            arrowA.InputDown += arrowA_MouseHeld;

            arrowB = new UIButton();
            var arrowBImg = new UIImage(arrowResource);
            arrowBImg.Color = new Color(96, 96, 96);
            arrowBImg.AddConstraint(Edge.Dock, arrowB, Edge.Dock);
            arrowB.AddDecoration(arrowBImg);
            arrowB.PointedColor = new Color(190, 190, 190);
            arrowB.PressedColor = new Color(120, 120, 120);
            arrowB.HighlightZoom = false;
            arrowB.InputDown += arrowB_MouseHeld;

            switch (orientation)
            {
                case ScrollBarOrientation.Vertical:
                    arrowAImg.SpriteEffect = SpriteEffects.FlipVertically;
                    arrowA.AddConstraint(Edge.Horizontal | Edge.Top, this, Edge.Horizontal | Edge.Top);
                    arrowB.AddConstraint(Edge.Horizontal, this, Edge.Horizontal);
                    arrowB.AddConstraint(Edge.Bottom, this, Edge.Bottom);
                    sliderBackground.AddConstraint(Edge.Horizontal, this, Edge.Horizontal);
                    sliderBackground.AddConstraint(Edge.Top, arrowA, Edge.Bottom);
                    sliderBackground.AddConstraint(Edge.Bottom, arrowB, Edge.Top);
                    slider.AddConstraint(Edge.Top, sliderBackground, Edge.Top, ConstraintCategory.Initialization);
                    slider.AddConstraint(Edge.Horizontal, sliderBackground, Edge.Horizontal);
                    break;

                case ScrollBarOrientation.Horizontal:
                    arrowBImg.SpriteEffect = SpriteEffects.FlipHorizontally;
                    arrowA.AddConstraint(Edge.Vertical | Edge.Left, this, Edge.Vertical | Edge.Left);
                    arrowB.AddConstraint(Edge.Vertical, this, Edge.Vertical);
                    arrowB.AddConstraint(Edge.Right, this, Edge.Right);
                    sliderBackground.AddConstraint(Edge.Vertical, this, Edge.Vertical);
                    sliderBackground.AddConstraint(Edge.Left, arrowA, Edge.Right);
                    sliderBackground.AddConstraint(Edge.Right, arrowB, Edge.Left);
                    slider.AddConstraint(Edge.Left, sliderBackground, Edge.Left, ConstraintCategory.Initialization);
                    slider.AddConstraint(Edge.Vertical, sliderBackground, Edge.Vertical);
                    break;
            }

            AbsorbPointer = false;
            //base.AbsorbPointer = true;
            //slider.AbsorbPointer = true;
            //arrowDown.AbsorbPointer = true;
            //arrowUp.AbsorbPointer = true;
            sliderBackground.AbsorbPointer = true;

            AddChild(arrowA);
            AddChild(arrowB);
            AddChild(sliderBackground);
            AddChild(slider);
        }
开发者ID:adamxi,项目名称:SharpDXFramework,代码行数:99,代码来源:UIScrollBar.cs

示例5: GetMenuEntry

        private UIControl GetMenuEntry(string label)
        {
            var btn = new UIButton();
            btn.Tag = label;
            btn.AddDecoration(new UILabel(label));
            //btn.NormalizedOrigin = Vector2.Zero;

            btn.AddConstraint(Edge.CenterX, menuPanel, Edge.CenterX, ConstraintCategory.All);

            if (previousEntry != null)
            {
                btn.AddConstraint(Edge.Top, previousEntry, Edge.Bottom, -20, ConstraintCategory.All);
            }

            previousEntry = btn;
            return btn;
        }
开发者ID:adamxi,项目名称:SharpDXFramework,代码行数:17,代码来源:UITestSceneMain.cs

示例6: UIWindow

        public UIWindow()
        {
            AutoSize = false;
            Alpha = 0f;
            MinimumSize = new Vector2(200);
            Size = new Vector2(350, 250);
            TopPanel = new UIPanel();
            BodyPanel = new UIPanel();
            BottomPanel = new UIPanel();

            // Top panel
            TopPanel.AddConstraint(Edge.Top, this, Edge.Top);
            TopPanel.AddConstraint(Edge.Horizontal, this, Edge.Horizontal);
            TopPanel.Color = Color.White;
            TopPanel.Alpha = 1f;
            TopPanel.Tag = nameof(TopPanel);
            TopPanel.InputMoved += TopPanel_InputMoved;
            TopPanel.InputReleasedAnywhere += TopPanel_InputReleasedAnywhere;

            titleLabel = new UILabel(nameof(UIWindow));
            titleLabel.AddConstraint(Edge.Top, TopPanel, Edge.Top);
            titleLabel.AddConstraint(Edge.Left, TopPanel, Edge.Left, 5);
            titleLabel.Tag = "Titel label";
            TopPanel.AddChild(titleLabel);

            btn_close = new UIButton();
            btn_close.InputEnter += btn_close_InputEnter;
            btn_close.InputLeave += btn_close_InputLeave;
            btn_close.AddDecoration(new UIImage("graphics/btn_close") { Color = Color.Black });
            btn_close.AddConstraint(Edge.TopRight, TopPanel, Edge.TopRight);
            btn_close.HighlightZoom = false;
            btn_close.InputReleased += Btn_close_InputReleased;
            TopPanel.AddChild(btn_close);

            btn_maximize = new UIButton();
            btn_maximize.Color = Color.Transparent;
            btn_maximize.PointedColor = new Color(190, 190, 190);
            btn_maximize.PressedColor = new Color(120, 120, 120);
            btn_maximize.PointedAlpha = 0.5f;
            btn_maximize.PressedAlpha = 0.5f;
            btn_maximize.AddDecoration(new UIImage(RESOURCE_MAXIMIZE) { Color = Color.Black });
            btn_maximize.AddConstraint(Edge.Top, btn_close, Edge.Top);
            btn_maximize.AddConstraint(Edge.Right, btn_close, Edge.Left, -1);
            btn_maximize.HighlightZoom = false;
            btn_maximize.InputReleased += Btn_maximize_InputReleased;
            TopPanel.AddChild(btn_maximize);

            btn_minimize = new UIButton();
            btn_minimize.Color = Color.Transparent;
            btn_minimize.PointedColor = new Color(190, 190, 190);
            btn_minimize.PressedColor = new Color(120, 120, 120);
            btn_minimize.PointedAlpha = 0.5f;
            btn_minimize.PressedAlpha = 0.5f;
            btn_minimize.AddDecoration(new UIImage("graphics/btn_minimize") { Color = Color.Black });
            btn_minimize.AddConstraint(Edge.Top, btn_maximize, Edge.Top);
            btn_minimize.AddConstraint(Edge.Right, btn_maximize, Edge.Left, -1);
            btn_minimize.HighlightZoom = false;
            btn_minimize.InputReleased += Btn_minimize_InputReleased;
            TopPanel.AddChild(btn_minimize);

            // Body panel
            BodyPanel.AddConstraint(Edge.Top, TopPanel, Edge.Bottom);
            BodyPanel.AddConstraint(Edge.Horizontal, this, Edge.Horizontal);
            BodyPanel.AddConstraint(Edge.Bottom, BottomPanel, Edge.Top);
            //BodyPanel.Color = Color.White;
            //BodyPanel.Alpha = 1f;
            BodyPanel.Tag = nameof(BodyPanel);

            // Bottom panel
            BottomPanel.AddConstraint(Edge.Bottom, this, Edge.Bottom);
            BottomPanel.AddConstraint(Edge.Horizontal, this, Edge.Horizontal);
            BottomPanel.Color = Color.White;
            BottomPanel.Alpha = 1f;
            BottomPanel.Tag = nameof(BottomPanel);
            BottomPanel.Size = new Vector2(0, 20);

            // Resize grip
            ResizeGrip = new UIImage("graphics/resizeGrip");
            ResizeGrip.Color = Color.Black;
            ResizeGrip.AddConstraint(Edge.BottomRight, BottomPanel, Edge.BottomRight);
            ResizeGrip.Tag = nameof(ResizeGrip);
            ResizeGrip.InputPressed += ResizeGrip_InputPressed;
            ResizeGrip.InputReleasedAnywhere += ResizeGrip_InputReleasedAnywhere;
            BottomPanel.AddChild(ResizeGrip);

            AddChild(TopPanel);
            AddChild(BodyPanel);
            AddChild(BottomPanel);

            Resizable = true;
        }
开发者ID:adamxi,项目名称:SharpDXFramework,代码行数:91,代码来源:UIWindow.cs


注:本文中的UIButton.AddDecoration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。