Click to See Complete Forum and Search --> : How can i paint a image box?


hdyeh
January 5th, 2000, 10:20 PM
I need to create a transparent image while in run time, unfountunately picture box doesn't support transparent images, i need image boxes to get the job done, but i don't know how to create a image box while in run time, please help.

Aaron Young
January 6th, 2000, 02:23 PM
If you have VB6, you can use the Add Method of the Forms Controls Collection, ie.

private Sub Command1_Click()
me.Controls.Add "VB.Image", "Image1"
me!image1.Move 0, 0
me!image1.Picture = LoadPicture("C:\Files\mypic.gif")
me!image1.Visible = true
End Sub



Otherwise you can create a single Image control at Design time and set its Index Property to Zero, creating a Control Array, then:

private Sub Command1_Click()
Load Image1(Image1.Count)
Image1(Image1.Count - 1).Move 0, 0
Image1(Image1.Count - 1).Picture = LoadPicture("C:\Files\mypic.gif")
Image1(Image1.Count - 1).Visible = true
End Sub




Aaron Young
Analyst Programmer
ajyoung@pressenter.com
aarony@redwingsoftware.com