控件总是要重新渲染,才正常显示

空怀 2012-04-06 04:05:42
我自己写了一个控件,但是系统运行后,只要有其他界面从该控件上移过,这个控件就像卡死的那样,再用鼠标悬浮或点一下就显示正常了。这是怎么回事啊,大家请指点下。
...全文
91 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
空怀 2012-04-09
  • 打赏
  • 举报
回复
以下是onpaint事件:
protected override void OnPaint(PaintEventArgs pevent)
{
base.OnPaint(pevent);

//底边
pevent.Graphics.DrawLine(penbottom, pevent.ClipRectangle.Left, pevent.ClipRectangle.Bottom - 1, pevent.ClipRectangle.Right - 1, pevent.ClipRectangle.Bottom - 1);

//右边
pevent.Graphics.DrawLine(penright, pevent.ClipRectangle.Right - 1, pevent.ClipRectangle.Top, pevent.ClipRectangle.Right - 1, pevent.ClipRectangle.Bottom);

//左边
pevent.Graphics.DrawLine(penleft, pevent.ClipRectangle.Left, pevent.ClipRectangle.Top, pevent.ClipRectangle.Left, pevent.ClipRectangle.Bottom);

//上边
pevent.Graphics.DrawLine(penleft, pevent.ClipRectangle.Left, pevent.ClipRectangle.Top, pevent.ClipRectangle.Right, pevent.ClipRectangle.Top);

}
jayeon 2012-04-06
  • 打赏
  • 举报
回复
代码拿出来看看。
空怀 2012-04-06
  • 打赏
  • 举报
回复
在onpaint事件中画了四条线,就是控件的边框。因为我想让控件有凹凸感。
anzhiqiang_touzi 2012-04-06
  • 打赏
  • 举报
回复
神马控件:CS还是BS的
CS的是你的控件绘制时候出了问题
BS的是你的js出了问题
bdmh 2012-04-06
  • 打赏
  • 举报
回复
控件里对鼠标移动或OnPaint中做什么代码了

110,567

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧