'Declare a picturebox
Public PictureBox2 As New Windows.Forms.PictureBox
'e.g Adding a zed graph as image in that picturebox
Public Sub create_graph_image()
With PictureBox2
.Height = 100
.Width = 100
.BackColor = Color.BlanchedAlmond
.Visible = True
.BorderStyle = BorderStyle.Fixed3D
PictureBox2.Tag = "filename"
AddHandler PictureBox2.Paint, AddressOf PictureboxAdd
End With
Me.Controls.Add(PictureBox2)
' Dim g As Graphics
' g = CType(PictureBox2, PictureBox).CreateGraphics
PictureBox2.Image = Me.ZedGraphControlB.GetImage()
' PictureBox2.Visible = True
End Sub
Public Sub PictureboxAdd(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs)
Dim p As Windows.Forms.PictureBox = DirectCast(sender, Windows.Forms.PictureBox)
Dim fnt As New Font("Times New Roman", 10, FontStyle.Regular)
e.Graphics.DrawString(p.Tag, fnt, Brushes.Black, 20, 20)
End Sub
No comments:
Post a Comment