vb.net怎么保持图片内容的持久性输出啊
vb.net中的picture图片属性autoredraw在vb.net中取消了,在vb.net中想保持图片内容持久性的输出该怎么办?...
vb.net中的picture图片属性autoredraw在 vb.net中取消了,在vb.net中想保持图片内容持久性的输出该怎么办?
展开
1个回答
展开全部
定义一个Bitmap,把图画到Bitmap上,然后 PictureBox1.Image = bm
下面是一个实例
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PictureBox1.Image = Nothing
Dim wid As Integer = PictureBox1.ClientSize.Width
Dim hgt As Integer = PictureBox1.ClientSize.Height
Dim bm As New Bitmap(wid, hgt)
Dim g As Graphics = Graphics.FromImage(bm)
Dim mPen As New Pen(Color.Red)
mPen.Width = 1
g.TranslateTransform(0, 100)
Dim x As Single
Dim y As Single
For i = 0 To 10
For x = i To (360) Step 0.1
y = 100 * Math.Sin(x * Math.PI / 180)
g.FillEllipse(Brushes.Blue, x, y, 3, 3)
My.Application.DoEvents()
Next
g.TranslateTransform(10, 0)
My.Application.DoEvents()
Next
PictureBox1.Image = bm
PictureBox1.Refresh()
g.Dispose()
End Sub
'其根本是定义一个Bitmap,把图画到Bitmap上,然后 PictureBox1.Image = bm
下面是一个实例
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PictureBox1.Image = Nothing
Dim wid As Integer = PictureBox1.ClientSize.Width
Dim hgt As Integer = PictureBox1.ClientSize.Height
Dim bm As New Bitmap(wid, hgt)
Dim g As Graphics = Graphics.FromImage(bm)
Dim mPen As New Pen(Color.Red)
mPen.Width = 1
g.TranslateTransform(0, 100)
Dim x As Single
Dim y As Single
For i = 0 To 10
For x = i To (360) Step 0.1
y = 100 * Math.Sin(x * Math.PI / 180)
g.FillEllipse(Brushes.Blue, x, y, 3, 3)
My.Application.DoEvents()
Next
g.TranslateTransform(10, 0)
My.Application.DoEvents()
Next
PictureBox1.Image = bm
PictureBox1.Refresh()
g.Dispose()
End Sub
'其根本是定义一个Bitmap,把图画到Bitmap上,然后 PictureBox1.Image = bm
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询