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


C# Forms.Label类代码示例

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


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

示例1: ChangeSettings

        public ChangeSettings()
        {
            InitializeComponent();

            for (int i = 0; i < Types.Length; i++)
            {
                if (Types[i] != typeof(bool))
                {
                    TextBox tb = new TextBox();
                    tb.Text = set[Names[i, 0]].ToString();
                    tb.Size = new Size(100, lineDist);
                    tb.Location = new Point(185, i * (lineDist + 5) + 20);
                    Controls.Add(tb);
                    controlList.Add(tb);
                    toolTip1.SetToolTip(tb, Names[i, 2]);
                }
                else
                {
                    CheckBox cb = new CheckBox();
                    cb.Checked = (bool)set[Names[i, 0]];
                    cb.Location = new Point(185, i * (lineDist + 5) + 20);
                    Controls.Add(cb);
                    controlList.Add(cb);
                    toolTip1.SetToolTip(cb, Names[i, 2]);
                }

                Label l = new Label();
                l.Text = Names[i, 1];
                l.AutoSize = true;
                l.Location = new Point(180 - TextRenderer.MeasureText(l.Text, new Font(l.Font.FontFamily, l.Font.Size, l.Font.Style)).Width, i * (lineDist + 5) + 20);
                Controls.Add(l);
                toolTip1.SetToolTip(l, Names[i, 2]);
            }
        }
开发者ID:c37-cae,项目名称:GrblHeightProbe2,代码行数:34,代码来源:ChangeSettings.cs

示例2: BuildDirPanel

		protected TextBox BuildDirPanel(Control parent, String name)
		{
			Panel panel = new Panel();
			panel.Dock = DockStyle.Top;
			panel.Height = 60;

			Label l = new Label();
			l.Location = new Point(0, 0);
			l.Dock = DockStyle.Left;
			l.Text = name;
			l.AutoSize = true;
			panel.Controls.Add(l);

			TextBox textBox = new TextBox();
			textBox.Location = new Point(10, 20);
			textBox.Width = ((ICustPanel)this).PreferredSize.Width - 40;
			panel.Controls.Add(textBox);
			
			// Don't have a reasonable directory browser and don't feel
			// like doing the P/Invoke for the underlying one.  Sigh.
			/*****
			Button b = new Button();
			b.Location = new Point(120, 20);
			b.Width = 20;
			b.Text = "...";
			b.Tag = textBox;
			b.Click += new EventHandler(DirButtonClicked);
			panel.Controls.Add(b);
			*****/
			
			parent.Controls.Add(panel);
			
			return textBox;
		}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:34,代码来源:CustDirPanel.cs

示例3: InitializeComponent

		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.btnRun = new System.Windows.Forms.Button();
			this.btnAbout = new System.Windows.Forms.Button();
			this.label1 = new System.Windows.Forms.Label();
			this.checkBox1 = new System.Windows.Forms.CheckBox();
			this.SuspendLayout();
			// 
			// btnRun
			// 
			this.btnRun.Location = new System.Drawing.Point(448, 56);
			this.btnRun.Name = "btnRun";
			this.btnRun.Size = new System.Drawing.Size(72, 23);
			this.btnRun.TabIndex = 2;
			this.btnRun.Text = "Run";
			this.btnRun.Click += new System.EventHandler(this.btnRun_Click);
			// 
			// btnAbout
			// 
			this.btnAbout.Location = new System.Drawing.Point(528, 56);
			this.btnAbout.Name = "btnAbout";
			this.btnAbout.TabIndex = 3;
			this.btnAbout.Text = "Close";
			this.btnAbout.Click += new System.EventHandler(this.btnAbout_Click);
			// 
			// label1
			// 
			this.label1.AutoSize = true;
			this.label1.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label1.Location = new System.Drawing.Point(16, 16);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(558, 18);
			this.label1.TabIndex = 4;
			this.label1.Text = "The sample demonstrates how to create percent stacked line chart in an excel work" +
				"book.";
			// 
			// checkBox1
			// 
			this.checkBox1.Location = new System.Drawing.Point(24, 48);
			this.checkBox1.Name = "checkBox1";
			this.checkBox1.Size = new System.Drawing.Size(160, 24);
			this.checkBox1.TabIndex = 5;
			this.checkBox1.Text = "Stacked markers chart";
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(616, 94);
			this.Controls.Add(this.checkBox1);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.btnAbout);
			this.Controls.Add(this.btnRun);
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "Form1";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "Chart sample";
			this.ResumeLayout(false);

		}
开发者ID:spirecomponent,项目名称:.NETExcelLibrary,代码行数:64,代码来源:Form1.cs

示例4: dataGridView1_CellDoubleClick

        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                Label lb = new Label();
                lb.AutoSize = true;
                lb.Margin = new Padding(3, 3, 3, 3);
                lb.BorderStyle = BorderStyle.FixedSingle;
                lb.Text = string.Format("{0} - {1}", this.dataGridView1.SelectedRows[0].Cells[0].Value.ToString(), this.dataGridView1.SelectedRows[0].Cells[1].Value.ToString());
                lb.Tag = string.Format("{0} {1}", this.dataGridView1.SelectedRows[0].Cells[0].Value.ToString(), this.dataGridView1.SelectedRows[0].Cells[2].Value.ToString());
                OnButtonClick lbClick = (object sender1, EventArgs e1) =>
                {
                    lb.Dispose();
                };
                lb.DoubleClick += new EventHandler(lbClick);

                this.flowLayoutPanel1.Controls.Add(lb);
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.ToString());
                MessageBox.Show(ex.Message);
                return;
            }
        }
开发者ID:57134898,项目名称:ZDContract,代码行数:25,代码来源:Sort.cs

示例5: osd_screen

		public osd_screen (int num, OSD aosd)
		{
			number=num;
			osd=aosd;
			
			num+=1;
			
			this.tabPage = new System.Windows.Forms.TabPage();		
			this.panelItems=new Panel[64];
			this.panelItems_default = new Panel[64];
			this.LIST_items=new System.Windows.Forms.TreeView();
			this.rbtSortCategory = new System.Windows.Forms.RadioButton();
            this.rbtSortAlphabetic = new System.Windows.Forms.RadioButton();
			this.groupBox = new System.Windows.Forms.GroupBox();
			this.label2 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.NUM_Y = new System.Windows.Forms.NumericUpDown();
            this.NUM_X = new System.Windows.Forms.NumericUpDown();
			this.pictureBox = new System.Windows.Forms.PictureBox();
			this.chkSign = new System.Windows.Forms.CheckBox();
			
			this.tabPage.SuspendLayout();
			this.groupBox.SuspendLayout();
			this.pictureBox.SuspendLayout();
		}
开发者ID:svpcom,项目名称:minimosd-extra,代码行数:25,代码来源:osd_screen.cs

示例6: InitializeComponent

 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.label1 = new System.Windows.Forms.Label();
     this.cbMouseActive = new System.Windows.Forms.CheckBox();
     this.SuspendLayout();
     //
     // label1
     //
     this.label1.Location = new System.Drawing.Point(0, 0);
     this.label1.Name = "label1";
     this.label1.Size = new System.Drawing.Size(240, 176);
     this.label1.TabIndex = 2;
     this.label1.Text = "label1";
     //
     // cbMouseActive
     //
     this.cbMouseActive.Location = new System.Drawing.Point(16, 176);
     this.cbMouseActive.Name = "cbMouseActive";
     this.cbMouseActive.Size = new System.Drawing.Size(128, 24);
     this.cbMouseActive.TabIndex = 3;
     this.cbMouseActive.Text = "Only MouseActive";
     //
     // SpritesUnderCursor
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize = new System.Drawing.Size(240, 197);
     this.Controls.Add(this.cbMouseActive);
     this.Controls.Add(this.label1);
     this.Name = "SpritesUnderCursor";
     this.Text = "SpritesUnderCursor";
     this.Paint += new System.Windows.Forms.PaintEventHandler(this.SpritesUnderCursor_Paint);
     this.ResumeLayout(false);
 }
开发者ID:timdetering,项目名称:Endogine,代码行数:37,代码来源:SpritesUnderCursor.cs

示例7: MethodParamForm

        public MethodParamForm(MethodCallInfo methodInfo)
        {
            _methodCallInfo = methodInfo;

            InitializeComponent();

            lblMethodTitle.Text = string.Format("{0} : {1}", methodInfo.MethodSignatureShort, methodInfo.ReturnType.Name);
            this.Parameters = new List<object>();
            _parameterControls = new List<Control>();

            int rowIndex = 0;
            foreach (var parameter in methodInfo.Parameters)
            {
                var lbl = new Label();
                tableLayoutPanel1.Controls.Add(lbl, 0, rowIndex);
                lbl.Dock = DockStyle.Fill;
                lbl.Text = string.Format("{0} : {1}", parameter.Name, parameter.ParameterType.Name);

                var ctrl = ParameterControlFactory.GetControl(parameter);
                tableLayoutPanel1.Controls.Add(ctrl, 1, rowIndex);
                ctrl.Dock = DockStyle.Fill;
                _parameterControls.Add(ctrl);
                rowIndex++;
            }
        }
开发者ID:jsnklpn,项目名称:jatan,代码行数:25,代码来源:MethodParamForm.cs

示例8: AssignCommandToLabel

 public void AssignCommandToLabel()
 {
     TestViewModel viewModel = new TestViewModel();
     using(var label = new Label()) {
         label.SetCommand(viewModel.TestCommand);
     }
 }
开发者ID:VitalyTVA,项目名称:WinMVVM,代码行数:7,代码来源:CommandProviderTests.cs

示例9: Change

        /// <summary>
        /// Changes data of an existing Kunde/Kontakt
        /// </summary>
        /// <param name="k">The to-be-changed Kunde/Kontakt</param>
        /// <param name="errorlabel">The label in which errormessages may be written</param>
        public void Change(KundeKontaktTable k, Label errorlabel)
        {
            errorlabel.Hide();

            IRule lnhsv = new LettersNumbersHyphenSpaceValidator();
            IRule lhv = new LettersHyphenValidator();
            IRule lengthv = new StringLength150Validator();

            DataBindingFramework.BindFromString(k.Vorname, "Vorname", errorlabel, true, lhv, lengthv);
            DataBindingFramework.BindFromString(k.NachnameFirmenname, "Nachname", errorlabel, false, lnhsv, lengthv);

            if (errorlabel.Visible)
            {
                throw new InvalidInputException();
            }

            // else save new Kunde or Kontakt in database
            if (k.Vorname.Length == 0)
            {
                this.logger.Log(Logger.Level.Info, "No first name will be stored.");
            }

            this.logger.Log(Logger.Level.Info, "User requested to change " + (k.Type == false ? "Kunde" : "Kontakt") + " with ID " + k.ID);

            // Update data
            try
            {
                DALFactory.GetDAL().UpdateKundeKontakte(k);
            }
            catch (SQLiteException)
            {
                throw;
            }
        }
开发者ID:broadcastzero,项目名称:swe2_backoffice,代码行数:39,代码来源:KundenKontakteChanger.cs

示例10: label_click

        private void label_click(object sender, EventArgs e)
        {
            if (timer1.Enabled == true) {
                return;
            }
            sw1.Start();
            Label labelClicked = sender as Label;
            if (labelClicked != null)
            {
                
                if (labelClicked.ForeColor.Equals(Color.Black)) 
                    return;

                if (firstClick == null)
                {
                    firstClick = labelClicked;
                    firstClick.ForeColor = Color.Black;
                    return;
                }

                secondClick = labelClicked;
                secondClick.ForeColor = Color.Black;
                checkIfWon();
                if (firstClick.Text == secondClick.Text) {
                    firstClick = null;
                    secondClick = null;
                    return;
                }
                timer1.Start();
            }
        }
开发者ID:ViktorMeduneckij,项目名称:MatchingGame,代码行数:31,代码来源:MatchingGame.cs

示例11: Load

        public new void Load(Tabs _tabs)
        {
            for (int i = 0; i < Properties.Length; i += 3)
            {
                int y = i * 9;

                string propertyName = Properties[i];
                string text = Properties[i + 1];
                string type = Properties[i + 2];

                Label label = new Label();
                label.Text = text;
                label.Location = new Point(0, y);
                label.Font = new Font("Calibri", 12);
                this.Controls.Add(label);

                switch (type)
                {
                    case "boolean":
                        break;
                }
            }
            this.tabs = _tabs;
            tabs.AddTab("Ustawienia", this);
        }
开发者ID:kubixlol2,项目名称:MinecraftServerManager,代码行数:25,代码来源:PropertiesEditor.cs

示例12: ImprimirGasto

        internal void ImprimirGasto(Label msjError, decimal monto, string gasto)
        {
            try
            {
                string ticket = Settings.Default.ticketGasto.Replace("##FECHA", DateTime.Now.ToString("dd-MM-yyyy")).
                Replace("##HORA", DateTime.Now.ToShortTimeString()).Replace("##NRO", obtenerNroTicketCocina().ToString());
                ticket = ticket + string.Format("{0:C}", monto).PadLeft(8) + "    " + gasto + "\r\n";

                try
                {
                    guardarArchivoTemp(ticket, out cantLineas);
                    configurarImpresora(ref formulario, cantLineas, 0);
                    formulario.PrinterSettings.PrinterName = obtenerImpresora("Tickets");// PrinterSettings.InstalledPrinters[2];//Seleccionar impresora cocina
                    formulario.Print();
                }
                catch (Exception e)
                {
                    msjError.Text = e.Message;
                }
            }
            catch (Exception ex)
            {
                msjError.Text = ex.Message;
                LoggerProxy.Error(ex.Message + " - " + ex.StackTrace);
            }
        }
开发者ID:eljavidelomas,项目名称:HotelApp,代码行数:26,代码来源:Impresora.cs

示例13: InitializeComponent

 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.uiGeneratingLabel = new System.Windows.Forms.Label();
     this.SuspendLayout();
     //
     // uiGeneratingLabel
     //
     this.uiGeneratingLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
     this.uiGeneratingLabel.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(0)), ((System.Byte)(0)));
     this.uiGeneratingLabel.Location = new System.Drawing.Point(82, 45);
     this.uiGeneratingLabel.Name = "uiGeneratingLabel";
     this.uiGeneratingLabel.TabIndex = 0;
     this.uiGeneratingLabel.Text = "Generating...";
     //
     // GeneratingWindow
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.BackColor = System.Drawing.SystemColors.Window;
     this.ClientSize = new System.Drawing.Size(264, 112);
     this.Controls.Add(this.uiGeneratingLabel);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
     this.Name = "GeneratingWindow";
     this.ShowInTaskbar = false;
     this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
     this.ResumeLayout(false);
 }
开发者ID:debuglevel,项目名称:iCodeGenerator,代码行数:30,代码来源:GeneratingWindow.cs

示例14: AddUpdatedLabel

        private void AddUpdatedLabel(string fieldName, string labelCaption)
        {
            if (String.IsNullOrEmpty(labelCaption))
                return;
            Label newLabel = new Label();
            newLabel.AutoSize = true;
            newLabel.Location = new System.Drawing.Point(labelUpdateIssueNote.Location.X, labelUpdateIssueNote.Location.Y);
            newLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
            newLabel.Name = "labelUpdateField_" + fieldName;
            newLabel.Size = new System.Drawing.Size(44, 13);
            newLabel.TabIndex = 4;
            newLabel.Text = labelCaption;
            newLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
            Controls.Add(newLabel);
            if (newLabel.Size.Width > Size.Width - newLabel.Location.X - 10)
                this.Size = new Size(newLabel.Location.X + newLabel.Size.Width + 10, this.Size.Height);

            SuspendLayout();
            int newLabelHeight = newLabel.Height + 5;
            Size = new System.Drawing.Size(Size.Width, Size.Height + newLabelHeight);
            MinimumSize = new System.Drawing.Size(MinimumSize.Width, MinimumSize.Height + newLabelHeight);
            labelUpdateIssueNote.MoveControl(0, newLabelHeight);
            TextBoxDescription.MoveControl(0, newLabelHeight);
            BtnSaveButton.MoveControl(0, newLabelHeight);
            BtnCancelButton.MoveControl(0, newLabelHeight);
            ResumeLayout(false);
        }
开发者ID:Jopie64,项目名称:redmine-desktop-client,代码行数:27,代码来源:UpdateIssueNoteForm.cs

示例15: InitializeComponent

		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.operation = new System.Windows.Forms.Label();
			this.SuspendLayout();
			// 
			// operation
			// 
			this.operation.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.operation.Dock = System.Windows.Forms.DockStyle.Fill;
			this.operation.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.operation.Location = new System.Drawing.Point(0, 0);
			this.operation.Name = "operation";
			this.operation.Size = new System.Drawing.Size(320, 40);
			this.operation.TabIndex = 0;
			this.operation.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// LongRunningOperationDisplay
			// 
			this.BackColor = System.Drawing.Color.LightYellow;
			this.ClientSize = new System.Drawing.Size(320, 40);
			this.ControlBox = false;
			this.Controls.Add(this.operation);
			this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "LongRunningOperationDisplay";
			this.ShowInTaskbar = false;
			this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
			this.ResumeLayout(false);
		}
开发者ID:Phaiax,项目名称:dotnetautoupdate,代码行数:35,代码来源:LongRunningOperationDisplay.cs


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