Winform中的常用控件使用

一些常见的winform基本控件的属性及方法

Label标签控件的属性及方法

代码:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Form02
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            linkLabel1.LinkVisited = true; // 确认超文本链接是按照链接后的样式呈现
            Form2 newForm2 = new Form2(); // 实例化Form2窗体,命名为newForm
            newForm2.Show(); // 将实例化的窗体打开
            this.Hide(); // 当前的窗体隐藏
        }

        private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            label2.Show(); // 当单击此链接时显示标签2
        }

        private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            label2.Hide(); // 当单击此链接时隐藏标签2
        }
    }
}

 界面:

 属性及方法

TextBox文本框控件属性和方法

Button按钮控件属性及方法

 

 

 

一直不明白打开一个控件后,怎么跳转到另一个控件,看到这里才明白用hide和show方法可以达到跳转页面的效果。

 

posted @ 2018-12-25 14:01  绯之雨  阅读(818)  评论(0编辑  收藏  举报