.net 我重写了form groupBox控件改变外框染色,但是当窗体被挡上之后再回来就不能刷新了,这是什么原因呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你怎么写的,把染色放到OnPaint事件中,以便重绘 我是这样写的,已经放过了 superman 10:37:06 protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); e.Graphics.Clear(base.BackColor); Rectangle Rtg_LT = new Rectangle(); Rectangle Rtg_RT = new Rectangle(); Rectangle Rtg_LB = new Rectangle(); Rectangle Rtg_RB = new Rectangle(); Rtg_LT.X = 0; Rtg_LT.Y = 7; Rtg_LT.Width = 10; Rtg_LT.Height = 10; Rtg_RT.X = e.ClipRectangle.Width - 11; Rtg_RT.Y = 7; Rtg_RT.Width = 10; Rtg_RT.Height = 10; Rtg_LB.X = 0; Rtg_LB.Y = e.ClipRectangle.Height - 11; Rtg_LB.Width = 10; Rtg_LB.Height = 10; Rtg_RB.X = e.ClipRectangle.Width - 11; Rtg_RB.Y = e.ClipRectangle.Height - 11; Rtg_RB.Width = 10; Rtg_RB.Height = 10; Color color = Color.FromArgb(140, 198, 64); Pen Pen_AL = new Pen(color, 1); //修改线宽 Pen_AL.Color = color; Brush brush = new HatchBrush(HatchStyle.Divot, color); e.Graphics.DrawString(base.Text, base.Font, brush, 6, 0); e.Graphics.DrawArc(Pen_AL, Rtg_LT, 180, 90); e.Graphics.DrawArc(Pen_AL, Rtg_RT, 270, 90); e.Graphics.DrawArc(Pen_AL, Rtg_LB, 90, 90); e.Graphics.DrawArc(Pen_AL, Rtg_RB, 0, 90); e.Graphics.DrawLine(Pen_AL, 5, 7, 6, 7); e.Graphics.DrawLine(Pen_AL, e.Graphics.MeasureString(base.Text, base.Font).Width + 3, 7, e.ClipRectangle.Width - 7, 7); e.Graphics.DrawLine(Pen_AL, 0, 13, 0, e.ClipRectangle.Height - 7); e.Graphics.DrawLine(Pen_AL, 6, e.ClipRectangle.Height - 1, e.ClipRectangle.Width - 7, e.ClipRectangle.Height - 1); e.Graphics.DrawLine(Pen_AL, e.ClipRectangle.Width - 1, e.ClipRectangle.Height - 7, e.ClipRectangle.Width - 1, 13); } SCSF的用法 Wpf的布局问题 C#中如何关闭某个进程的网络连接 C# 中如何把STRING转换键盘代码 C# 30分钟开一个速度,然后1分钟开另一个速度,如此循环,怎么用timer编 DataSet更新数据库 【求助】请问 用udpclient接收文件后如何将它转换成文件啊?多谢 高手请进!!急 C# 调用cmd.exe 请问关于ASCX文件的问题 如何读取文件并将其内容添加到combox中 怎么才能实现图片打印功能。。。。求代码
superman 10:37:06
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
e.Graphics.Clear(base.BackColor); Rectangle Rtg_LT = new Rectangle(); Rectangle Rtg_RT = new Rectangle(); Rectangle Rtg_LB = new Rectangle();
Rectangle Rtg_RB = new Rectangle(); Rtg_LT.X = 0; Rtg_LT.Y = 7; Rtg_LT.Width = 10; Rtg_LT.Height = 10;
Rtg_RT.X = e.ClipRectangle.Width - 11; Rtg_RT.Y = 7; Rtg_RT.Width = 10; Rtg_RT.Height = 10;
Rtg_LB.X = 0; Rtg_LB.Y = e.ClipRectangle.Height - 11; Rtg_LB.Width = 10; Rtg_LB.Height = 10; Rtg_RB.X = e.ClipRectangle.Width - 11; Rtg_RB.Y = e.ClipRectangle.Height - 11; Rtg_RB.Width = 10; Rtg_RB.Height = 10; Color color = Color.FromArgb(140, 198, 64); Pen Pen_AL = new Pen(color, 1); //修改线宽 Pen_AL.Color = color; Brush brush = new HatchBrush(HatchStyle.Divot, color); e.Graphics.DrawString(base.Text, base.Font, brush, 6, 0); e.Graphics.DrawArc(Pen_AL, Rtg_LT, 180, 90); e.Graphics.DrawArc(Pen_AL, Rtg_RT, 270, 90); e.Graphics.DrawArc(Pen_AL, Rtg_LB, 90, 90); e.Graphics.DrawArc(Pen_AL, Rtg_RB, 0, 90); e.Graphics.DrawLine(Pen_AL, 5, 7, 6, 7); e.Graphics.DrawLine(Pen_AL, e.Graphics.MeasureString(base.Text, base.Font).Width + 3, 7, e.ClipRectangle.Width - 7, 7); e.Graphics.DrawLine(Pen_AL, 0, 13, 0, e.ClipRectangle.Height - 7); e.Graphics.DrawLine(Pen_AL, 6, e.ClipRectangle.Height - 1, e.ClipRectangle.Width - 7, e.ClipRectangle.Height - 1); e.Graphics.DrawLine(Pen_AL, e.ClipRectangle.Width - 1, e.ClipRectangle.Height - 7, e.ClipRectangle.Width - 1, 13);
}