需要判断控件TextBox是否可以输入,将文本内容自动填入该TextBox
回答:简单写了一个说明
using System;
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button_fill_Click(object sender, EventArgs e)
{
//将文本内容自动填入?什么文本内容呢?这里默认给一个字符串吧
if (!textBox1.ReadOnly)
textBox1.Text = "你好,world";
}
private void button_turn_Click(object sender, EventArgs e)
{
textBox1.ReadOnly = !textBox1.ReadOnly;
}
private void button_clear_Click(object sender, EventArgs e)
{
textBox1.Text = "";
}
}
}