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


C# Forms.Label类代码示例

本文整理汇总了C#中Eto.Forms.Label的典型用法代码示例。如果您正苦于以下问题:C# Label类的具体用法?C# Label怎么用?C# Label使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Label类属于Eto.Forms命名空间,在下文中一共展示了Label类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Init

		void Init()
		{
			var label1 = new Label
			{
				Text = "Welcome to",
				Font = new Font(FontFamilies.Monospace, 30)
			};
			var labelTitle = new Label
			{
				Text = "Altman3",
				Font = new Font(FontFamilies.Monospace, 60)
			};

			var layout = new PixelLayout();
			layout.Add(label1, new Point(70, 50));
			layout.Add(labelTitle, new Point(100, 120));

			var logo = PluginServiceProvider.GetService("ToFingerBinary");
			if (logo != null)
			{
				var rnd = new Random();
				var par = new PluginParameter();
				par.AddParameter("str", rnd.Next(1, 1023));
				var ret = logo(par);
				var tmp = new Label
				{
					Text = ret,
					Font = new Font(FontFamilies.Monospace, 10)
				};
				layout.Add(tmp, new Point(300, 220));
			}

			Content = layout;
		}
开发者ID:kevins1022,项目名称:Altman,代码行数:34,代码来源:PanelIndex.cs

示例2: CursorSection

		public CursorSection()
		{
			var layout = new TableLayout();
			layout.Spacing = new Size(20, 20);

			TableRow row;

			layout.Rows.Add(row = new TableRow());

			foreach (var type in Enum.GetValues(typeof(CursorType)).OfType<CursorType?>())
			{
				var label = new Label
				{ 
					Size = new Size(100, 50), 
					Text = type.ToString(),
					VerticalAlignment = VerticalAlignment.Center,
					TextAlignment = TextAlignment.Center,
					BackgroundColor = Colors.Silver
				};
				if (type == null)
					label.Cursor = null;
				else
					label.Cursor = new Cursor(type.Value);
				row.Cells.Add(label);

				if (row.Cells.Count > 3)
					layout.Rows.Add(row = new TableRow());
			}

			Content = TableLayout.AutoSized(layout, centered: true);

		}
开发者ID:mhusen,项目名称:Eto,代码行数:32,代码来源:CursorSection.cs

示例3: GetWindow

		protected override Forms.Window GetWindow()
		{
			// Add splitters like this:
			// |---------------------------
			// |        |      |          |
			// |  P0    |  P2  |   P4     |
			// | -------|      |          |  <== These are on MainPanel
			// |  P1    |------|          |
			// |        |  P3  |          |
			// |---------------------------
			// |         status0..4,      |  <== These are on StatusPanel
			// ----------------------------

			Label[] status = new Label[] { new Label(), new Label(), new Label(), new Label(), new Label() };

			// Status bar
			var statusPanel = new Panel { };
			var statusLayout = new DynamicLayout(Padding.Empty, Size.Empty);
			statusLayout.BeginHorizontal();
			for (var i = 0; i < status.Length; ++i)
				statusLayout.Add(status[i], xscale: true);
			statusLayout.EndHorizontal();
			statusPanel.Content = statusLayout;

			// Splitter windows
			Panel[] p = new Panel[] { new Panel(), new Panel(), new Panel(), new Panel(), new Panel() };
			var colors = new Color[] { Colors.PaleTurquoise, Colors.Olive, Colors.NavajoWhite, Colors.Purple, Colors.Orange };
			var count = 0;
			for (var i = 0; i < p.Length; ++i)
			{
				var temp = i;
				//p[i].BackgroundColor = colors[i];
				var button = new Button { Text = "Click to update status " + i.ToString(), BackgroundColor = colors[i] };
				button.Click += (s, e) => status[temp].Text = "New count: " + (count++).ToString();
				p[i].Content = button;
			}

			var p0_1 = new Splitter { Panel1 = p[0], Panel2 = p[1], Orientation = SplitterOrientation.Vertical, Position = 200 };
			var p2_3 = new Splitter { Panel1 = p[2], Panel2 = p[3], Orientation = SplitterOrientation.Vertical, Position = 200 };
			var p01_23 = new Splitter { Panel1 = p0_1, Panel2 = p2_3, Orientation = SplitterOrientation.Horizontal, Position = 200};
			var p0123_4 = new Splitter { Panel1 = p01_23, Panel2 = p[4], Orientation = SplitterOrientation.Horizontal, Position = 400 };

			// Main panel
			var mainPanel = new Panel();
			mainPanel.Content = p0123_4;

			// Form's content
			var layout = new DynamicLayout();
			layout.Add(mainPanel, yscale: true);
			layout.Add(statusPanel);
			layout.Generate();
			var form = new Form 
			{ 
				Size = new Size(800, 600),
				Content = layout
			};
			return form;
		}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:58,代码来源:SplitterSection.cs

示例4: HiSumDisplay

        public HiSumDisplay()
        {
            // sets the client (inner) size of the window for your content
            ClientSize = new Eto.Drawing.Size(600, 400);

            Title = "HiSum";
            TreeGridView view = new TreeGridView(){Height = 500};

            view.Columns.Add(new GridColumn() { HeaderText = "Summary", DataCell = new TextBoxCell(0), AutoSize = true, Resizable = true, Editable = false });
            var textbox = new TextBox() {Width = 1000};
            var button = new Button(){Text = "Go", Width = 15};
            var label = new Label() {Width = 100};
            var tbResult = new TextArea() {Width = 1000};

            button.Click += (sender, e) =>
            {
                Reader reader = new Reader();
                List<int> top100 = reader.GetTop100();
                List<FullStory> fullStories = new List<FullStory>();
                foreach (int storyID in top100.Take(30))
                {
                    FullStory fullStory = reader.GetStoryFull(storyID);
                    fullStories.Add(fullStory);
                }
                TreeGridItemCollection data = GetTree(fullStories);
                view.DataStore = data;
            };
            Content = new TableLayout
            {
                Spacing = new Size(5, 5), // space between each cell
                Padding = new Padding(10, 10, 10, 10), // space around the table's sides
                Rows = {
                    new TableRow(
                        new Label{Text = "Input URL from Hacker News: ",Width=200},
                        textbox,
                        button,
                        label
                    ),
                    new TableRow(
                        null,
                        tbResult,
                        null,
                        null
                        ),
                    new TableRow(
                        new Label(),
                        view
                    ),

                    // by default, the last row & column will get scaled. This adds a row at the end to take the extra space of the form.
                    // otherwise, the above row will get scaled and stretch the TextBox/ComboBox/CheckBox to fill the remaining height.
                    new TableRow { ScaleHeight = true }
                }
            };
        }
开发者ID:kzganesan,项目名称:HackerNewsSummary,代码行数:55,代码来源:HiSumDisplay.cs

示例5: WebView

		Control WebView()
		{
			try
			{
				webView = new WebView();

				webView.Navigated += (sender, e) =>
				{
					Log.Write(webView, "Navigated, Uri: {0}", e.Uri);
					UpdateButtons();
				};
				webView.DocumentLoading += (sender, e) =>
				{
					Log.Write(webView, "DocumentLoading, Uri: {0}, IsMainFrame: {1}", e.Uri, e.IsMainFrame);
					e.Cancel = cancelLoad.Checked ?? false;
					if (!e.Cancel)
					{
						UpdateButtons();
						stopButton.Enabled = true;
					}
				};
				webView.DocumentLoaded += (sender, e) =>
				{
					Log.Write(webView, "DocumentLoaded, Uri: {0}", e.Uri);
					UpdateButtons();
					stopButton.Enabled = false;
				};
				webView.OpenNewWindow += (sender, e) =>
				{
					Log.Write(webView, "OpenNewWindow: {0}, Url: {1}", e.NewWindowName, e.Uri);
				};
				webView.DocumentTitleChanged += delegate(object sender, WebViewTitleEventArgs e)
				{
					titleLabel.Text = e.Title;
				};
				return webView;

			}
			catch (Exception)
			{
				var control = new Label
				{
					Text = string.Format("WebView not supported on this platform with the {0} generator", Platform.ID),
					BackgroundColor = Colors.Red,
					TextAlignment = TextAlignment.Center,
					VerticalAlignment = VerticalAlignment.Center,
					TextColor = Colors.White
				};
				if (Platform.IsGtk)
					Log.Write(this, "You must install webkit-sharp for WebView to work under GTK. Note that GTK does not support webkit-sharp on any platform other than Linux.");
				return control;
			}


		}
开发者ID:mhusen,项目名称:Eto,代码行数:55,代码来源:WebViewSection.cs

示例6: MyForm

		public MyForm()
		{
			// Set ClientSize instead of Size, as each platform has different window border sizes
			ClientSize = new Size(600, 400);

			// Title to show in the title bar
			Title = "Hello, Eto.Forms";

			// Content of the form
			Content = new Label { Text = "Some content", VerticalAlign = VerticalAlign.Middle, HorizontalAlign = HorizontalAlign.Center };
		}
开发者ID:mhusen,项目名称:Eto,代码行数:11,代码来源:Main.cs

示例7: HoverNodeLabel

		Control HoverNodeLabel()
		{
			hoverNodeLabel = new Label();

			treeView.MouseMove += (sender, e) => {
				var node = treeView.GetNodeAt(e.Location);
				hoverNodeLabel.Text = "Item under mouse: " + (node != null ? node.Text : "(no node)");
			};

			return hoverNodeLabel;
		}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:11,代码来源:TreeViewSection.cs

示例8: DesignerUserControl

		public DesignerUserControl()
		{
			BackgroundColor = Colors.White;
			Padding = new Padding(20);
			Content = label = new Label
			{
				VerticalAlignment = VerticalAlignment.Center,
				TextAlignment = TextAlignment.Center,
				Font = SystemFonts.Default(8),
				Text = "[User Control]"
			};
		}
开发者ID:picoe,项目名称:Eto,代码行数:12,代码来源:DesignerUserControl.cs

示例9: CreateAccountButton

        Control CreateAccountButton()
        {
            var control = new Label { Text = "Create a New Account", TextColor = Colors.Blue };
            control.MouseDown += (sender, e) => {
                var uri = new UriBuilder(this.serverAddress.Text) {
                    Path = "account/register"
                };

                Application.Instance.Open(uri.ToString());
            };
            return control;
        }
开发者ID:nerdfury,项目名称:JabbR.Desktop,代码行数:12,代码来源:JabbRServerEdit.cs

示例10: AddLabelledSection

		public static void AddLabelledSection (this DynamicLayout layout, string text, Control control)
		{
			var label = new Label { Text = text, VerticalAlign = VerticalAlign.Middle };
#if DESKTOP
			layout.AddRow (Label, control);
#elif MOBILE
			layout.BeginVertical ();
			layout.Add (label);
			layout.Add (control);
			layout.EndVertical ();
#endif
		}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:12,代码来源:DynamicLayoutExtensions.cs

示例11: MaskedTextBoxSection

		public MaskedTextBoxSection()
		{
			Spacing = 5;
			Padding = new Padding(10);
			var tb = new NumericMaskedTextBox<decimal> { Value = 123.456M };
			var l = new Label();
			l.TextBinding.Bind(Binding.Property(tb, c => c.Value).Convert(r => "Value: " + Convert.ToString(r)));
			Items.Add(new StackLayout { Orientation = Orientation.Horizontal, Spacing = 5, Items = { tb, l } });
			Items.Add(new MaskedTextBox(new FixedMaskedTextProvider("(999) 000-0000")) { ShowPromptOnFocus = true, PlaceholderText = "(123) 456-7890" });
			Items.Add(new MaskedTextBox<DateTime>(new FixedMaskedTextProvider<DateTime>("&&/90/0000") { ConvertToValue = DateTime.Parse }));
			Items.Add(new MaskedTextBox(new FixedMaskedTextProvider(">L0L 0L0")));
			Items.Add(new MaskedTextBox { InsertMode = InsertKeyMode.Toggle });
		}
开发者ID:mhusen,项目名称:Eto,代码行数:13,代码来源:MaskedTextBoxSection.cs

示例12: Construct

		private void Construct()
		{
			Title = "My Eto Form";
			ClientSize = new Size(400, 350);

            lblContent = new Label { Text = "Hello World!" };
            prgBar = new ProgressBar();

			// scrollable region as the main content
			Content = new Scrollable
			{
				// table with three rows
				Content = new TableLayout(
					null,
					// row with three columns
					new TableRow(null, lblContent, null),
                    new TableRow(null, prgBar, null)
				)
			};

			// create a few commands that can be used for the menu and toolbar
            cmdButton = new Command { MenuText = "Click Me!", ToolBarText = "Click Me!" };

			var quitCommand = new Command { MenuText = "Quit", Shortcut = Application.Instance.CommonModifier | Keys.Q };
			quitCommand.Executed += (sender, e) => Application.Instance.Quit();

			var aboutCommand = new Command { MenuText = "About..." };
			aboutCommand.Executed += (sender, e) => MessageBox.Show(this, "About my app...");

			// create menu
			Menu = new MenuBar
			{
				Items =
				{
					// File submenu
					new ButtonMenuItem { Text = "&File", Items = { cmdButton } },
					// new ButtonMenuItem { Text = "&Edit", Items = { /* commands/items */ } },
					// new ButtonMenuItem { Text = "&View", Items = { /* commands/items */ } },
				},
				ApplicationItems =
				{
					// application (OS X) or file menu (others)
					new ButtonMenuItem { Text = "&Preferences..." },
				},
				QuitItem = quitCommand,
				AboutItem = aboutCommand
			};

			// create toolbar			
            ToolBar = new ToolBar { Items = { cmdButton } };
		}
开发者ID:MASGAU,项目名称:2.0,代码行数:51,代码来源:MainForm.View.cs

示例13: SystemColorSection

		public SystemColorSection()
		{
			var layout = new StackLayout
			{
				Spacing = 10,
				HorizontalContentAlignment = HorizontalAlignment.Stretch
			};

			var type = typeof(SystemColors);

			var properties = type.GetRuntimeProperties();

			var skip = new List<PropertyInfo>();
			var colorProperties = properties.Where(r => r.PropertyType == typeof(Color)).OrderBy(r => r.Name).ToList();
			foreach (var property in colorProperties)
			{
				if (skip.Contains(property))
					continue;
				var color = (Color)property.GetValue(null);
				var label = new Label { Text = property.Name };
				var panel = new Panel
				{ 
					Content = label,
					Padding = new Padding(10),
				};

				bool isTextColor = property.Name.EndsWith("Text");

				if (isTextColor)
					label.TextColor = color;
				else
				{
					panel.BackgroundColor = color;
					var textProp = colorProperties.FirstOrDefault(r => r.Name == property.Name + "Text");
					if (textProp != null)
					{
						label.TextColor = (Color)textProp.GetValue(null);
						label.Text += " && " + textProp.Name;
						skip.Add(textProp);
					}
					else if (color.ToHSB().B < 0.5)
						label.TextColor = Colors.White;
				}

				layout.Items.Add(panel);
			}

			Content = new Scrollable { Content = TableLayout.AutoSized(layout, centered: true) };

		}
开发者ID:mhusen,项目名称:Eto,代码行数:50,代码来源:SystemColorSection.cs

示例14: Init

        void Init()
        {
            //_labelDownload
            _labelDownload = new Label();

            //_progressBarDownload
            _progressBarDownload = new ProgressBar();

            var layout = new DynamicLayout {Padding = new Padding(5, 5), Spacing = new Size(5, 5)};
            layout.AddRow(_labelDownload);
            layout.AddRow(_progressBarDownload);

            Content = layout;
            Icon = Application.Instance.MainForm.Icon;
        }
开发者ID:imjiang,项目名称:Altman,代码行数:15,代码来源:InstallForm.UI.cs

示例15: About

        public About()
        {
            /* dialog attributes */

            this.Title = "About Notedown";
            this.MinimumSize = new Size(300, 0);
            this.Resizable = false;

            /* dialog controls */

            var imageView = new ImageView();
            imageView.Image = Icon.FromResource("Icon.ico");
            imageView.Size = new Size(128, 128);

            var labelTitle = new Label();
            labelTitle.Text = "Notedown";
            labelTitle.Font = new Font(FontFamilies.Sans, 16);
            labelTitle.HorizontalAlign = HorizontalAlign.Center;

            var version = Assembly.GetExecutingAssembly().GetName().Version;
            var labelVersion = new Label();
            labelVersion.Text = string.Format("Version {0}", version);
            labelVersion.HorizontalAlign = HorizontalAlign.Center;

            var labelCopyright = new Label();
            labelCopyright.Text = "Copyright by Andre Straubmeier";
            labelCopyright.HorizontalAlign = HorizontalAlign.Center;

            var button = new Button();
            button.Text = "Close";
            button.Click += (sender, e) => Close();

            /* dialog layout */

            Content = new TableLayout
            {
                Padding = new Padding(10),
                Spacing = new Size(5, 5),
                Rows =
                {
                    imageView, labelTitle, labelVersion, labelCopyright,
                    TableLayout.AutoSized(button, centered: true)
                }
            };

            AbortButton = DefaultButton = button;
        }
开发者ID:andererandre,项目名称:Notedown,代码行数:47,代码来源:About.cs


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