vb2005在picturebox中用drawstring方法画出的文字闪了一下就消失了 求解! 10
PublicClassForm1FriendWithEventspictureAsSystem.Windows.Forms.PictureBoxPrivateSubBut...
Public Class Form1
Friend WithEvents picture As System.Windows.Forms.PictureBox
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.picture = New System.Windows.Forms.PictureBox
Me.Panel1.Controls.Add(Me.picture)
Me.picture.Location = New Point(0, 0)
Me.picture.Visible = True
Me.picture.Name = "picture"
Me.picture.Size = New System.Drawing.Size(130, 84)
Me.picture.TabIndex = 0
Me.picture.TabStop = False
Dim g As Graphics = picture.CreateGraphics()
Dim mBrush As New SolidBrush(Color.Black)
Dim mfont As New Font("宋体", 48)
g.DrawString("ABD", mfont, mBrush, 0, 0)
End Sub
End Class
我就是想新增一个picturebox然后用drawstring在上面画文字但事件触发后文字只出现了一瞬间就消失了,picturebox依然存在。如果直接拖一个picturebox到界面上则不会出现那种问题。有人能帮我解释下么? 展开
Friend WithEvents picture As System.Windows.Forms.PictureBox
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.picture = New System.Windows.Forms.PictureBox
Me.Panel1.Controls.Add(Me.picture)
Me.picture.Location = New Point(0, 0)
Me.picture.Visible = True
Me.picture.Name = "picture"
Me.picture.Size = New System.Drawing.Size(130, 84)
Me.picture.TabIndex = 0
Me.picture.TabStop = False
Dim g As Graphics = picture.CreateGraphics()
Dim mBrush As New SolidBrush(Color.Black)
Dim mfont As New Font("宋体", 48)
g.DrawString("ABD", mfont, mBrush, 0, 0)
End Sub
End Class
我就是想新增一个picturebox然后用drawstring在上面画文字但事件触发后文字只出现了一瞬间就消失了,picturebox依然存在。如果直接拖一个picturebox到界面上则不会出现那种问题。有人能帮我解释下么? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询