當前位置: 首頁>>代碼示例>>C#>>正文


C# Xwt.Label類代碼示例

本文整理匯總了C#中Xwt.Label的典型用法代碼示例。如果您正苦於以下問題:C# Label類的具體用法?C# Label怎麽用?C# Label使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Label類屬於Xwt命名空間,在下文中一共展示了Label類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Splash

        public Splash()
        {
            Decorated = false;
            ShowInTaskbar = false;
            box = new VBox {
                Margin = -2,
            };
            imageView = new ImageView {
                Image = Image.FromResource (Resources.Splash),
            };
            progressBar = new ProgressBar {
                Indeterminate = true,
                TooltipText = Catalog.GetString ("Loading..."),
            };
            info = new Label {
                Text = Catalog.GetString ("Loading..."),
                TextAlignment = Alignment.Center,
            };
            box.PackStart (imageView);
            box.PackEnd (progressBar);
            box.PackEnd (info);

            Content = box;

            InitialLocation = WindowLocation.CenterScreen;
        }
開發者ID:hamekoz,項目名稱:hamekoz-sharp,代碼行數:26,代碼來源:Splash.cs

示例2: MenuSamples

		public MenuSamples ()
		{
			Label la = new Label ("Right click here to show the context menu");
			menu = new Menu ();
			menu.Items.Add (new MenuItem ("One"));
			menu.Items.Add (new MenuItem ("Two"));
			menu.Items.Add (new MenuItem ("Three"));
			menu.Items.Add (new SeparatorMenuItem ());

			var rgroup = new RadioButtonMenuItemGroup ();
			menu.Items.Add (new RadioButtonMenuItem ("Opt 1") { Group = rgroup, Sensitive = false });
			menu.Items.Add (new RadioButtonMenuItem ("Opt 2") { Group = rgroup, Checked = true });
			menu.Items.Add (new RadioButtonMenuItem ("Opt 3") { Group = rgroup });

			menu.Items.Add (new SeparatorMenuItem ());

			menu.Items.Add (new CheckBoxMenuItem ("Check 1"));
			menu.Items.Add (new CheckBoxMenuItem ("Check 2") { Checked = true });

			menu.Items.Add (new SeparatorMenuItem ());

			var subMenu = new MenuItem ("Submenu");
			subMenu.SubMenu = new Menu ();
			var subZoomIn = new MenuItem (new Command ("Zoom+", StockIcons.ZoomIn));
			var subZoomOut = new MenuItem (new Command ("Zoom-", StockIcons.ZoomOut));
			subMenu.SubMenu.Items.Add (subZoomIn);
			subMenu.SubMenu.Items.Add (subZoomOut);
			menu.Items.Add (subMenu);

			subZoomIn.Clicked += (sender, e) => MessageDialog.ShowMessage ("'Zoom+' item clicked.");
			subZoomOut.Clicked += (sender, e) => MessageDialog.ShowMessage ("'Zoom-' item clicked.");

			la.ButtonPressed += HandleButtonPressed;
			PackStart (la);
		}
開發者ID:m13253,項目名稱:xwt,代碼行數:35,代碼來源:MenuSamples.cs

示例3: Makeup

 public override Xwt.Widget Makeup(IXwtWrapper Parent)
 {
     Xwt.Label Target = new Xwt.Label()
     {
         TextAlignment = this.Align,
         Text = this.Text,
         Ellipsize = this.Ellipsize,
         Wrap = this.Wrap
     };
     if (this.Markup != "")
         Target.Markup = this.Markup;
     if (this.Color != "")
         Target.TextColor = Xwt.Drawing.Color.FromName(this.Color);
     //Binding
     if (Source != "")
     {
         Target.Text = (string)PathBind.GetValue(Source, Parent, "");
         Parent.PropertyChanged += (o, e) =>
         {
             if (e.PropertyName == this.Source.Split('.')[0])
                 Xwt.Application.Invoke(() => Target.Text = (string)PathBind.GetValue(Source, Parent, ""));
         };
     }
     WindowController.TryAttachEvent(Target, "LinkClicked", Parent, LinkClicked);
     InitWidget(Target, Parent);
     return Target;
 }
開發者ID:ksigne,項目名稱:xwt-extensions,代碼行數:27,代碼來源:XwtLabelNode.cs

示例4: ScrollbarSample

		public ScrollbarSample ()
		{
			WidthRequest = 300;
			HeightRequest = 300;

			canvas = new Canvas ();
			label = new Label ("Use the scrollbars\nto move this label");
			canvas.AddChild (label);

			Add (canvas, 0, 0, hexpand:true, vexpand:true);

			vscroll = new VScrollbar () {
				LowerValue = 0,
				UpperValue = 300,
				PageIncrement = 10,
				PageSize = 50,
				StepIncrement = 1
			};
			Add (vscroll, 1, 0, vexpand:true);
			
			hscroll = new HScrollbar () {
				LowerValue = 0,
				UpperValue = 300,
				PageIncrement = 10,
				PageSize = 50,
				StepIncrement = 1
			};
			Add (hscroll, 0, 1, hexpand:true);

			vscroll.ValueChanged += HandleValueChanged;
			hscroll.ValueChanged += HandleValueChanged;
		}
開發者ID:m13253,項目名稱:xwt,代碼行數:32,代碼來源:ScrollbarSample.cs

示例5: DependencyWidget

		public DependencyWidget (IConnectedService service, IConnectedServiceDependency dependency)
		{
			Dependency = dependency;
			Service = service;

			iconView = new ImageView (dependency.Icon.WithSize (Xwt.IconSize.Small));
			nameLabel = new Label (dependency.DisplayName);

			statusIconView = new ImageView ();
			statusLabel = new Label ();
			statusLabel.LinkClicked += (sender, e) => {
				if (dependency.Status == Status.NotAdded)
					dependency.AddToProject (CancellationToken.None);
				e.SetHandled ();
			};

			container = new HBox ();
			container.PackStart (iconView);
			container.PackStart (nameLabel);
			container.PackStart (statusIconView);
			container.PackStart (statusLabel);

			Content = container;
			Update ();

			dependency.StatusChanged += HandleDependencyStatusChange;
			service.StatusChanged += HandleServiceStatusChanged;
		}
開發者ID:kdubau,項目名稱:monodevelop,代碼行數:28,代碼來源:DependenciesSectionWidget.cs

示例6: DependenciesSectionWidget

		public DependenciesSectionWidget (IConfigurationSection section) 
		{
			this.section = section;

			widget = new VBox ();

			if (this.section.Service.Dependencies.Length == 0) {
				widget.PackStart (new Label { Text = GettextCatalog.GetString ("This service has no dependencies") });
				return;
			}

			bool firstCategory = true;

			foreach (var category in this.section.Service.Dependencies.Select (d => d.Category).Distinct ()) {
				var categoryIcon = new ImageView (category.Icon.WithSize (IconSize.Small));
				var categoryLabel = new Label (category.Name);
				var categoryBox = new HBox ();

				if (!firstCategory)
					categoryBox.MarginTop += 5;

				categoryBox.PackStart (categoryIcon);
				categoryBox.PackStart (categoryLabel);
				widget.PackStart (categoryBox);

				foreach (var dependency in this.section.Service.Dependencies.Where (d => d.Category == category)) {
					widget.PackStart (new DependencyWidget (section.Service, dependency) {
						MarginLeft = category.Icon.Size.Width / 2
					});
				}

				if (firstCategory)
					firstCategory = false;
			}
		}
開發者ID:kdubau,項目名稱:monodevelop,代碼行數:35,代碼來源:DependenciesSectionWidget.cs

示例7: TextEntries

        public TextEntries()
        {
            TextEntry te1 = new TextEntry ();
            PackStart (te1);

            Label la = new Label ();
            PackStart (la);
            te1.Changed += delegate {
                la.Text = "Text: " + te1.Text;
            };

            PackStart (new Label ("Entry with small font"));
            TextEntry te2 = new TextEntry ();
            te2.Font = te2.Font.WithScaledSize (0.5);
            PackStart (te2);

            PackStart (new Label ("Entry with placeholder text"));
            TextEntry te3 = new TextEntry ();
            te3.PlaceholderText = "Placeholder text";
            PackStart (te3);

            PackStart (new Label ("Entry with no frame"));
            TextEntry te4 = new TextEntry();
            te4.ShowFrame = false;
            PackStart (te4);

            TextEntry te5 = new TextEntry ();
            te5.Text = "I should be centered!";
            te5.TextAlignment = Alignment.Center;
            PackStart (te5);
        }
開發者ID:jbeaurain,項目名稱:xwt,代碼行數:31,代碼來源:TextEntries.cs

示例8: DatePickerSample

		public DatePickerSample ()
		{
			var dtp = new DatePicker (DateTime.Now);
			PackStart (dtp);

			Label la1 = new Label ("Initial Value: " + dtp.DateTime);
			PackStart (la1);
			dtp.ValueChanged += delegate {
				la1.Text = "Value changed: " + dtp.DateTime;
			};

			var dp = new DatePicker (DatePickerStyle.Date);
			PackStart (dp);

			Label la2 = new Label ("Initial Value: " + dp.DateTime);
			PackStart (la2);
			dp.ValueChanged += delegate {
				la2.Text = "Value changed: " + dp.DateTime;
			};

			var tp = new DatePicker (DatePickerStyle.Time, DateTime.MinValue);
			PackStart (tp);

			Label la3 = new Label ("Initial Value: " + tp.DateTime);
			PackStart (la3);
			tp.ValueChanged += delegate {
				la3.Text = "Value changed: " + tp.DateTime;
			};
		}
開發者ID:m13253,項目名稱:xwt,代碼行數:29,代碼來源:DatePickerSample.cs

示例9: Build

        private void Build()
        {
            this.Icon = Xwt.Drawing.Image.FromResource("URMSimulator.Resources.urm.png");
            this.Title = "About";
            this.Resizable = false;
            this.Buttons.Add(new DialogButton(Command.Close));

            vbox1 = new VBox();

            image1 = new ImageView();
            image1.WidthRequest = 320;
            image1.HeightRequest = 270;
            vbox1.PackStart(image1);

            labelProgramName = new Label();
            labelProgramName.TextAlignment = Alignment.Center;
            vbox1.PackStart(labelProgramName);

            labelComments = new Label();
            labelComments.TextAlignment = Alignment.Center;
            vbox1.PackStart(labelComments);

            hbox1 = new HBox();

            hbox1.PackStart(new HBox(), true);

            labelWebsite = new LinkLabel();
            labelWebsite.TextAlignment = Alignment.Center; //text aligment doesn't work with Xwt.WPF
            hbox1.PackStart(labelWebsite, false);

            hbox1.PackStart(new HBox(), true);
            vbox1.PackStart(hbox1);

            this.Content = vbox1;
        }
開發者ID:cra0zy,項目名稱:URMSimulator,代碼行數:35,代碼來源:AboutDialog.GUI.cs

示例10: PluginTitleWidget

        public PluginTitleWidget(PluginType type)
        {
            PluginType = type;

            label = new Label()
            {
                Text = type.GetName(),
                TextColor = type.GetColor(),
                Font = Font.WithScaledSize(2d),
                HeightRequest = 30,
                WidthRequest = 400,
            };

            MarginTop = 8;

            HeightRequest = 30;
            WidthRequest = 400;

            AddChild(label, 0, 0);

            if (App.InitOpacityAnimation != null)
            {
                Opacity = 0;
                App.InitOpacityAnimation(this);
            }
        }
開發者ID:fourtf,項目名稱:4Plug,代碼行數:26,代碼來源:PluginTitleWidget.cs

示例11: RadioButtonSample

		public RadioButtonSample ()
		{
			var b1 = new RadioButton ("Item 1");
			var b2 = new RadioButton ("Item 2 (red background)");
			b2.BackgroundColor = Xwt.Drawing.Colors.Red;
			var b3 = new RadioButton ("Item 3");
			b2.Group = b3.Group = b1.Group;
			PackStart (b1);
			PackStart (b2);
			PackStart (b3);

			var la = new Label ();
			la.Hide ();
			b1.Group.ActiveRadioButtonChanged += delegate {
				la.Show ();
				la.Text = "Active: " + b1.Group.ActiveRadioButton.Label;
			};
			PackStart (la);

			PackStart (new HSeparator ());

			var box = new VBox ();
			box.PackStart (new Label ("First Option"));
			box.PackStart (new Label ("Second line"));

			var b4 = new RadioButton (box);
			var b5 = new RadioButton ("Second Option");
			var b6 = new RadioButton ("Disabled Option") { Sensitive = false };
			PackStart (b4);
			PackStart (b5);
			PackStart (b6);
			b4.Group = b5.Group = b6.Group;
		}
開發者ID:m13253,項目名稱:xwt,代碼行數:33,代碼來源:RadioButtonSample.cs

示例12: RadioButtonSample

        public RadioButtonSample()
        {
            var b1 = new RadioButton ("Item 1");
            var b2 = new RadioButton ("Item 2");
            var b3 = new RadioButton ("Item 3");
            b2.Group = b3.Group = b1.Group;
            PackStart (b1);
            PackStart (b2);
            PackStart (b3);

            var la = new Label ();
            la.Hide ();
            b1.Group.ActiveRadioButtonChanged += delegate {
                la.Show ();
                la.Text = "Active: " + b1.Group.ActiveRadioButton.Label;
            };
            PackStart (la);

            PackStart (new HSeparator ());

            var box = new VBox ();
            box.PackStart (new Label ("First Option"));
            box.PackStart (new Label ("Second line"));

            var b4 = new RadioButton (box);
            var b5 = new RadioButton ("Second Option");
            PackStart (b4);
            PackStart (b5);
            b4.Group = b5.Group;
        }
開發者ID:Gaushick,項目名稱:xwt,代碼行數:30,代碼來源:RadioButtonSample.cs

示例13: Labels

        public Labels()
        {
            Label la = new Label ("Simple label");
            PackStart (la);

            la = new Label ("Label with red background") {
                BackgroundColor = new Xwt.Drawing.Color (1, 0, 0)
            };
            PackStart (la);

            la = new Label ("Label with red background and blue foreground") {
                BackgroundColor = new Xwt.Drawing.Color (1, 0, 0),
                TextColor = new Xwt.Drawing.Color (0, 0, 1)
            };
            PackStart (la);

            la = new Label ("A crazy long label text with a lots of content and information in it but fortunately it should appear wrapped");
            la.Wrap = WrapMode.Word;
            PackStart (la);

            la = new Label ("Another Label with red background") {
                BackgroundColor = new Xwt.Drawing.Color (1, 0, 0),
                TextColor = new Xwt.Drawing.Color (0, 0, 1)
            };
            PackStart (la);

            la = new Label () { Markup = "Label with <b>bold</b> and <span color='#ff0000'>red</span> text" };
            PackStart (la);

            la = new Label () { Markup = "Label with a <a href='http://xamarin.com'>link</a> to a web site." };
            PackStart (la);
        }
開發者ID:nite2006,項目名稱:xwt,代碼行數:32,代碼來源:Labels.cs

示例14: AddPluginWidget

        public AddPluginWidget(PluginType type)
        {
            PluginType = type;
            HeightRequest = PluginWidget.Size.Height;
            WidthRequest = PluginWidget.Size.Width;

            Margin = PluginWidget.Margin;

            Cursor = CursorType.Hand;

            Label l = new Label("Add new " + type.GetName());
            //l.TextColor = type.GetColor();

            l.TextAlignment = Alignment.Center;

            AddChild(l, new Rectangle(0, 0, PluginWidget.Size.Width, PluginWidget.Size.Height));

            BackgroundColor = type.GetBGColor();

            if (App.InitDropShadow != null)
                App.InitDropShadow(this);

            if (App.InitOpacityAnimation != null)
            {
                Opacity = 0;
                App.InitOpacityAnimation(this);
            }
        }
開發者ID:fourtf,項目名稱:4Plug,代碼行數:28,代碼來源:AddPluginWidget.cs

示例15: AlignCenter

		public void AlignCenter ()
		{
			var la = new Label ("Some text here");
			la.TextAlignment = Alignment.Center;
			la.BackgroundColor = Xwt.Drawing.Colors.LightGray;
			CheckWidgetRender ("Label.AlignCenter.png", la);
		}
開發者ID:m13253,項目名稱:xwt,代碼行數:7,代碼來源:LabelTests.cs


注:本文中的Xwt.Label類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。