日期:2014-05-17  浏览次数:20736 次

自定义控件重绘问题!
 protected override void OnDraw()
        {
            Image broculoImage = global::Test.Properties.Resources.Building;
            int width = broculoImage.Size.Width;
            int height = broculoImage.Size.Height;
            Rectangle big = new Rectangle(0, 0, 64, 64);
            this.graphics.ScaleTransform(this.m_Scale, this.m_Scale, MatrixOrder.Prepend);
            this.graphics.DrawImage(broculoImage, big);
        }
代码如上,我自定义了一个控件,然后在鼠标点击的事件中实现缩小一半的功能,但是出现下图的问题,原来的依然存在,怎么处理?求指导!

 protected override void OnMouseDown(MouseEventArgs e)
    {
        base.OnMouseDown(e);
          this.m_Scale = 0.5F;
          this.Invalidate();
}

------解决方案--------------------
this.graphics.Clear(this.BackColor);