
添加一个Panel控件之后,双击就打开了Panel控件的Panit事件处理方法.
private void panel1_Paint(object sender, PaintEventArgs e){
ControlPaint.DrawBorder(e.Graphics,
panel4.ClientRectangle,
Color.Red,
3,
ButtonBorderStyle.Solid,
Color.Red,
3,
ButtonBorderStyle.Solid,
Color.Red,
3,
ButtonBorderStyle.Solid,
Color.Red,
3,
ButtonBorderStyle.Solid)
}
原生的TextBox不支持修改边框颜色,所以你需要重写一个Textbox控件。参照这里:
http://wenku.baidu.com/view/64910db565ce0508763213ef.html
如果你对于重写控件或者绘制这种技能比较不顺手的话,可以考虑这样:
将TextBox 的边框样式设置为None,然后在其底下放一个PictureBox,PictureBox里放一个大小适中、带边框的图片。
这样看起来就是文本框有了边框了。
然后再为TextBox设置MouseHover事件,改变PictureBox的Image便实现了变色。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)