我正在重写textbox控件,但写完后每次在窗体上插入这个控件时visual studio就会停止运行
我的代码看起来也没问题啊,为什么一插入窗体就死机呢
public partial class textbox : UserControl
{
public textbox()
{
InitializeComponent();
}
public Color Color { get; set; } = Color.White;
public Color ShapeColor { get; set; } = Color.DodgerBlue;
public string TextboxText
{
get
{
return TextboxText;
}
set
{
TextboxText = value;
}
}
private void textbox_Paint(object sender, PaintEventArgs e)
{
Graphics graphics = e.Graphics;
graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
Pen pen = new Pen(ShapeColor, 1);
graphics.DrawArc(pen, 0, 0, 8, 8, 180, 90);
graphics.DrawLine(pen, 4, 0, this.Width - 5, 0);
graphics.DrawArc(pen, this.Width - 9, 0, 8, 8, 270, 90);
graphics.DrawLine(pen, this.Width - 1, 4, this.Width - 1, this.Height - 5);
graphics.DrawArc(pen, this.Width - 9, this.Height - 9, 8, 8, 0, 90);
graphics.DrawLine(pen, 4, this.Height - 1, this.Width - 5, this.Height - 1);
graphics.DrawArc(pen, 0, this.Height - 9, 8, 8, 90, 90);
graphics.DrawLine(pen, 0, 4, 0, this.Height - 5);
richTextBox1.BackColor = Color;
richTextBox1.Text = TextboxText;
}
private void textbox_Load(object sender, EventArgs e)
{
richTextBox1.Height = this.Height - 6;
richTextBox1.Width = this.Width - 6;
}
private void textbox_Resize(object sender, EventArgs e)
{
richTextBox1.Height = this.Height - 6;
richTextBox1.Width = this.Width - 6;
}
}
这是visual studio的特性吗?