Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding an Image control at code

Status
Not open for further replies.

ShaneBrennan

Programmer
May 19, 1999
198
GB
Following on from my Transparent Form problem, I've decided to try something else.

Instead of placing the Transparent Gif on the form at the implementation stage, I want to place it on the form AFTER I've made the form transparent. Has anyone got any ideas how to:

1) Place an image control on the form;
2) Specify it's top,left coordinates;
3) Make it the right size
4) set the picture property tot he image I want to display.

The problem with this I think is that, I need the image in the EXE - not as a seperate file.

Thanks for any help ppl

Shane

Shane Brennan
Shane.Brennan@tcat.ac.uk

 
The only way you can do this is to have a control array, and place the first control in the array on the form at design time. So, you have to add an image control to the form, named Image1 for this demo, and set its index property to 0. Next set it's visible property to False.

In code then, you can load another image control by using Load Image1(1). Image1(1) will then inherit the properties of Image1(0), including the visible property so this has to be set to true to show.

This code will do what you want, but I don't know if it will solve your problem???

Private Sub Form_Load()

Load Image1(1)
Image1(1).Picture = LoadPicture("c:\aa\test.gif")
Image1(1).Top = 0
Image1(1).Left = 0
Image1(1).Width = Form1.Width
Image1(1).Height = Form1.Height
Image1(1).Visible = True
Image1(1).Refresh

End Sub


Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top