【发布时间】:2012-03-12 20:17:37
【问题描述】:
好的,我在 winform 顶部有一个按钮,在表单构造函数中我有 Graphics obj = this.CreateGraphics();
当鼠标进入事件触发时
MainFormGraphicsHandle.DrawRectangle( new Pen(Color.CornflowerBlue, 2.0f),
this.MdPlayerButton.Location.X - 2, this.MdPlayerButton.Location.Y - 2,
this.MdPlayerButton.Size.Width + 4, this.MdPlayerButton.Size.Height + 4);
鼠标离开时触发
MainFormGraphicsHandle.DrawRectangle(new Pen(this.BackColor, 2.0f), this.MdPlayerButton.Location.X - 2,this.MdPlayerButton.Location.Y - 2, this.MdPlayerButton.Size.Width + 4, this.MdPlayerButton.Size.Height + 4);
在矩形上绘制矩形是否会导致内存泄漏或其他问题,或者突出显示按钮是否是一种好习惯?
我希望能够调整我的表单大小,因此不建议使用现成的图像并在它们之间进行交换。
谢谢!
【问题讨论】:
标签: winforms c#-4.0 button memory-leaks gdi