textbox 系統控制元件,直接改肯定是沒辦法的,只能自己重寫控制元件,繼承TextBox
而且圓角應該只能完全重寫控制元件
給你個改邊框顏色的程式碼
public class MyTextBox : TextBox
{
public MyTextBox()
this.BorderStyle = BorderStyle.FixedSingle;
}
protected override void WndProc(ref Message m)
base.WndProc(ref m);
if (m.Msg == 0xf || m.Msg == 0x14 || m.Msg == 0x85)
if (this.BorderStyle == BorderStyle.FixedSingle)
using (Graphics g = Graphics.FromHwnd(this.Handle))
using (Pen pen = new Pen(Color.Red))
g.DrawRectangle(pen, 0, 0, this.Width - 1, this.Height - 1);
textbox 系統控制元件,直接改肯定是沒辦法的,只能自己重寫控制元件,繼承TextBox
而且圓角應該只能完全重寫控制元件
給你個改邊框顏色的程式碼
public class MyTextBox : TextBox
{
public MyTextBox()
{
this.BorderStyle = BorderStyle.FixedSingle;
}
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (m.Msg == 0xf || m.Msg == 0x14 || m.Msg == 0x85)
{
if (this.BorderStyle == BorderStyle.FixedSingle)
{
using (Graphics g = Graphics.FromHwnd(this.Handle))
{
using (Pen pen = new Pen(Color.Red))
{
g.DrawRectangle(pen, 0, 0, this.Width - 1, this.Height - 1);
}
}
}
}
}
}