110,534
社区成员
发帖
与我相关
我的任务
分享
using System.Windows.Forms.VisualStyles;
private void Form1_Load(object sender, EventArgs e)
{
textBox1.BorderStyle = BorderStyle.None;
pictureBox1.Top = textBox1.Top;
pictureBox1.Left = textBox1.Left + textBox1.Width;
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
VisualStyleRenderer vVisualStyleRenderer =
new VisualStyleRenderer(VisualStyleElement.TextBox.TextEdit.Normal);
Rectangle vRectangle = textBox1.Bounds;
vRectangle.X -= 2;
vRectangle.Y -= 2;
vRectangle.Height += 4;
vRectangle.Width += 4 + pictureBox1.Width;
vVisualStyleRenderer.DrawBackground(e.Graphics, vRectangle);
}