vb.net:删除特定的绘制的位图 [英] vb.net: Remove specific painted bitmap
本文介绍了vb.net:删除特定的绘制的位图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好!
我使用
- 私人Sub paint_Paint(ByVal发送者作为对象,ByVal e作为System.Windows.Forms.PaintEventArgs)处理Me.Paint
- Private Sub paint_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
并使用E.graphic.Drawimage函数
and uses the E.graphic.Drawimage function
但是我该如何删除特殊的绘画对象?我认为这是处置",但尝试时只会出错.
But how do i remove a spesific painted object? I think it is Dispose but just getting a error when trying it.
//西蒙(Simon)
//Simon
推荐答案
嗨
基本上,只是不要在paint事件中重新绘制对象.您可能有一些逻辑来确定是否需要在重新绘制中包含对象.
Basically, just don't repaint the object in the paint event. You could have some logic to determine if an object needs to be included in the repaint or not.
例如,在我的一个项目中,在绘画事件中,我有如下代码:
For example, in one of my projects, in the paint event I have code such as :
For Each c As Prog In EPGlist
Fmt.Alignment = StringAlignment.Near
With c
If .Channel <> hch Then
y += gfh + spacing
hch = .Channel
End If
x = (DateDiff(DateInterval.Minute, GridStart, .Strt) - HS.Value) * GridStretch
.Bounds = New Rectangle(x, y - VS.Value, (.Dur * GridStretch) - spacing, gfh)
If Me.Panel1.Bounds.IntersectsWith(.Bounds) Then
Bcol.Color = My.Settings.EPGbc
Fcol.Color = My.Settings.EPGfc
Fnt = My.Settings.EPGfont
If .Strt < Now Then
Bcol.Color = My.Settings.EPGpastStartColB
Fcol.Color = My.Settings.EPGpastStartColF
End If
' and a whole lot more code follows.
这篇关于vb.net:删除特定的绘制的位图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文