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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change BackgroundImage based on image on disk

Status
Not open for further replies.

ldejesuspr

Programmer
Jul 29, 2004
27
PR
Hello

I have a .exe with forms with a BackgroundImage defined in the properties of the form. I would like to change the background image without having to recompile. I thought that by just replacing the image in disk with another as long i would use the same name it would be ok but it does not do the trick. Can amybody help on accomplishing this? Also I tried assigning in the load of the form the backgroundimage property but then i get some flickering that i certainly dont want.

Thanks in advance

ldj
 
Thanks Rick. How do I access the constructor of the form? Would this have any effect on code in the form load?

thanks

ldj
 
The constructor's code is in the "windows generated code, do not change" region. And the name of that region is rather stupid, why MS wants to hide the constructor, I have no idea.

Anyways, the constructor is the first thing that happens. When you instantiate the object (use the New keyword) the constructor is fired. So by setting the back ground image there, it will be set before the form is loaded. The load even happens later, I can't remember the exact sequency anymore, but you can wind up with paint events firing while the load procedure is still running. That's what is causing the flicker you saw.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Rick,

I tried it and it worked perfectly!

thanks a lot for the easy to implement tip

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top