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;
}
}
}