GetPicture and SetPicture example for Visual Basic

To use this code, you must first add a PictureBox control to your form, and make it invisible.

' Hide the LEAD control
Lead1.Visible = False

'Assign the picture object to the PictureBox control
Picture1 = Lead1.GetPicture

'Give the PictureBox control the same size and position as the LEAD control
Picture1.Top = Lead1.Top
Picture1.Left = Lead1.Left
Picture1.Height = Lead1.Height
Picture1.Width = Lead1.Width

'Interrupt with a message.
MsgBox "This is the PictureBox. Click OK for the SetPicture method"

'Get the picture object back to the LEAD control and repaint it
Lead1.AutoSetRects = False ' Keep the previous display rectangles.
Lead1.SetPicture Picture1 ' Load the bitmap from the PictureBox control.
Picture1.Visible = False ' Hide the PictureBox control.
Lead1.Visible = True ' Make the LEAD control visible.
Lead1.ForceRepaint