实验要求:
1.单击按钮能将文本框复制内容传给标签
2.标签字体16,红色
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)
{
label1.Font = new System.Drawing.Font("宋体",16);
label1.ForeColor = Color.Red;
}
private void label1_Click(object sender, EventArgs e)
{
button1.Text = "复制选择文本至标签";
}
private void button1_Click(object sender, EventArgs e)
{
label1.Text = textBox1.SelectedText;
}
}
}