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


C# Button.SetStyle方法代码示例

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


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

示例1: CreateGUI

		void CreateGUI()
		{
			var cache = ResourceCache;
			UI ui = UI;

			UIElement root = ui.Root;
			// Load the style sheet from xml
			root.SetDefaultStyle(cache.GetXmlFile("UI/DefaultStyle.xml"));

			for (int i = 0; i < 10; i++)
			{
				Button b = new Button();
				root.AddChild(b);
				// Reference a style from the style sheet loaded earlier:
				b.SetStyle("Button", null);
				b.SetSize(300, 100);
				b.Position = new IntVector2(50 * i, 50 * i);

				b.SubscribeToDragMove(HandleDragMove);
				b.SubscribeToDragBegin(HandleDragBegin);
				b.SubscribeToDragCancel(HandleDragCancel);
				b.SubscribeToDragEnd(HandleDragEnd);

				{
					var t = new Text();
					b.AddChild(t);
					t.SetStyle("Text", null);
					t.HorizontalAlignment = HorizontalAlignment.Center;
					t.VerticalAlignment = VerticalAlignment.Center;
					t.Name = ("Text");
				}

				{
					var t = new Text();
					b.AddChild(t);
					t.SetStyle("Text", null);
					t.Name=("Event Touch");
					t.HorizontalAlignment=HorizontalAlignment.Center;
					t.VerticalAlignment=VerticalAlignment.Bottom;
				}

				{
					var t = new Text();
					b.AddChild(t);
					t.SetStyle("Text", null);
					t.Name=("Num Touch");
					t.HorizontalAlignment=HorizontalAlignment.Center;
					t.VerticalAlignment=VerticalAlignment.Top;
				}
			}

			for (int i = 0; i< 10; i++)
			{
				var t = new Text();
				root.AddChild(t);
				t.SetStyle("Text", null);
				t.Name=("Touch "+ i);
				t.Visible = false;
			}
		}
开发者ID:cianmulville,项目名称:urho-samples,代码行数:60,代码来源:UIDrag.cs

示例2: AddButton

    private void AddButton()
    {
        _count++;
        Button btn = new Button
                         {
                             SkinClass = typeof(ButtonSkin5),
                             Icon = ImageLoader.Instance.Load("Icons/star_big"),
                             FocusEnabled = false,
                             Width = 200,
                             Height = 200,
                             MinWidth = 200,
                             MinHeight = 200,
                             Text = "Button " + _count,
                             Tooltip = "Resizable Button"
                         };

        btn.SetStyle("addedEffect", _tweenFactory);
        _panel.AddContentChild(btn);
    }
开发者ID:groov0v,项目名称:edriven-gui,代码行数:19,代码来源:AddChildDemo.cs

示例3: AddButton

    private void AddButton()
    {
        _count++;
        Button btn = new Button
                         {
                             FocusEnabled = false,
                             Width = 200 + _random.Next((int)(Stage.Width / 2 - 200)),
                             Height = 200 + _random.Next((int)(Stage.Height / 2 - 200)),
                             MinWidth = 200,
                             MinHeight = 200,
                             Text = "Button " + _count,
                             Tooltip = "Resizable Button"
                         };
        btn.X = _random.Next((int)(Stage.Width - btn.Width));
        btn.Y = _random.Next((int)(Stage.Height - btn.Height));

        btn.Plugins.Add(new Resizable()/* { ShowOverlay = false }*/);
        btn.SetStyle("addedEffect", _tweenFactory);
        _viewport.AddChild(btn);
    }
开发者ID:groov0v,项目名称:edriven-gui,代码行数:20,代码来源:ResizableDemo.cs

示例4: InitWindow

        void InitWindow()
        {
            // Create the Window and add it to the UI's root node
            window = new Window();
            uiRoot.AddChild(window);

            // Set Window size and layout settings
            window.SetMinSize(384, 192);
            window.SetLayout(LayoutMode.Vertical, 6, new IntRect(6, 6, 6, 6));
            window.SetAlignment(HorizontalAlignment.Center, VerticalAlignment.Center);
            window.Name = "Window";

            // Create Window 'titlebar' container
            UIElement titleBar = new UIElement();
            titleBar.SetMinSize(0, 24);
            titleBar.VerticalAlignment = VerticalAlignment.Top;
            titleBar.LayoutMode = LayoutMode.Horizontal;

            // Create the Window title Text
            var windowTitle = new Text();
            windowTitle.Name = "WindowTitle";
            windowTitle.Value = "Hello GUI!";

            // Create the Window's close button
            Button buttonClose = new Button();
            buttonClose.Name = "CloseButton";

            // Add the controls to the title bar
            titleBar.AddChild(windowTitle);
            titleBar.AddChild(buttonClose);

            // Add the title bar to the Window
            window.AddChild(titleBar);

            // Apply styles
            window.SetStyleAuto(null);
            windowTitle.SetStyleAuto(null);
            buttonClose.SetStyle("CloseButton", null);

            buttonClose.SubscribeToReleased(_ => Engine.Exit());

            // Subscribe also to all UI mouse clicks just to see where we have clicked
            UI.SubscribeToUIMouseClick(HandleControlClicked);
        }
开发者ID:ZENG-Yuhao,项目名称:Xamarin-CrossPlatform,代码行数:44,代码来源:HelloGUI.cs


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