【问题标题】:C# clear draw in paintC# 清除绘图
【发布时间】:2013-09-25 10:15:37
【问题描述】:

我使用 this.Invalidate();清楚但一切都清楚。我只需要清楚我之前画的。

            private void AfyTextBox_Paint(object sender, PaintEventArgs e)
        {

            if (afytransparentTextBox.BackColor.A != 255 || afytransparentTextBox.BackColor.B != 255 || afytransparentTextBox.BackColor.G != 255 || afytransparentTextBox.BackColor.R != 255)
            {
                path = RoundedRectangle.Create(1, 1, this.Width - 7, this.Height - 7, 2); // Draw around
                e.Graphics.DrawPath(new Pen(afytransparentTextBox.BackColor), path);
            }
            else
            {
                //Here I need to clean that I drew earlier.( Draw around)
            }
}

【问题讨论】:

    标签: c# .net winforms


    【解决方案1】:

    你可以试试这个method:

    Graphics.Clear();

    【讨论】:

    【解决方案2】:

    您不能从表面“取消绘制”。您必须清除并重新绘制您想要显示的内容。通常使用Invalidate 方法告诉组件重新绘制自己就足够了。你可以有一个布尔标志来控制你的临时覆盖框是否被绘制。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-17
      • 1970-01-01
      • 1970-01-01
      • 2014-05-03
      • 1970-01-01
      相关资源
      最近更新 更多