在C#中如何使用标签控件

C#标签控件

  • 标签控件用作窗体上的显示文本。
  • 标签提供了用户无法更改但可以读取以获取表单信息的静态文本。

C#标签控件示例

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

 namespace WindowsFormsApplication2

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

 

        private void Form1_Load(object sender, EventArgs e)

        {

            this.Text="标签示例";

            label1.Text="这是标签示例";

            label1.BorderStyle= BorderStyle.Fixed3D;

            label1.TextAlign = ContentAlignment.MiddleCenter;

        }

    }

}
日期:2020-04-11 23:03:39 来源:oir作者:oir