Click here to Skip to main content
15,885,878 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to change background image randomly on form load through imagelist
but how..............
Posted
Updated 28-Jul-13 19:52pm
v2
Comments
Sergey Alexandrovich Kryukov 29-Jul-13 1:58am    
What do you mean "how"? By writing some code. Do you have any particular problem with that?
—SA
arvindnitin7 29-Jul-13 2:01am    
i want to change background image of windows form randomly like windows 7
plz help me
Sergey Alexandrovich Kryukov 29-Jul-13 2:07am    
You should have mentioned it, about "random". Not clear what prevented you just read MSDN documentation.
I answered anyway. Do you know how to use the class System.Random? If not, read about it in MSDN.
—SA
arvindnitin7 29-Jul-13 2:18am    
but i want change many images back to back in 2 sec like windows 7
Sergey Alexandrovich Kryukov 29-Jul-13 10:03am    
And what's the problem? Do it.
—SA

1 solution

Isn't that enough: http://msdn.microsoft.com/en-us/library/system.windows.forms.control.backgroundimage.aspx[^]?

If you need something more sophisticated, simply render whatever your want of the surface of the form overriding the virtual method System.Windows.Forms.Control.OnPaint or handling the form's event Paint. If the image should change from time to time, change the data used in rendering (index of the image in the image list, for example) and call System.Windows.Forms.Control.Invalidate.

—SA
 
Share this answer
 
Comments
Maciej Los 29-Jul-13 3:18am    
+5!
Sergey Alexandrovich Kryukov 29-Jul-13 10:02am    
Thank you, Maciej,
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900