using System;
using System.Drawing;
using System.Windows.Forms;
namespace HighLIght
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load( object sender, EventArgs e )
{
// 以编程的方式向窗体添加控件
TextBox txtMy1 = new TextBox();
txtMy1.Location = new Point(50, 60);
this.Controls.Add(txtMy1);
txtMy1.Height = 50;
txtMy1.Width = 200;
txtMy1.Text = "落木千山天远大,澄江一道月分明。";
txtMy1.SelectionStart = 3;
txtMy1.SelectionLength = 6;
}
}
}
以编程的方式向窗体添加控件以及对内容高亮显示
最新推荐文章于 2021-06-11 08:00:00 发布