How do I toggle between two images on a Button
?
I have a "Lock" and "Unlock" image I would like to use on the same button.
So far I have used the property window to set a single image..
UPDATE: Many good answers, but I should have mention that my two images is in the Property folder. How do I access them with a relative path?
Easy:
button1.Image = System.Drawing.Image.FromFile(@"C:\Users\Administrator\Pictures\forestfloor.jpg");
P.S. Before set image, check if it exist
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With