Click here to Skip to main content
15,891,372 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hai,
c#.net 4.0 windows form ,Off_image to click to open ON_image in same location and
ON_image click to change Off_image same location.

Like Camera On and Camera off.

first time when i click camera_Off to change Camera_On.
After it is reverse.

Regards,
Karthikeyan
Posted
Updated 14-Sep-12 23:24pm
v2
Comments
_Amy 15-Sep-12 2:49am    
Why so confused? Why every time camera on and camera off :lol: ? What do you need actually?
pkarthionline 15-Sep-12 3:07am    
i have two images 1.CameraOn Image 2.CameraOff Image.
Pageload => CameraOff Image Show.
I want to take photo when i click CameraOff Img to CameraOn Img it should take photo.

After take photo it will change to CameraOff Image.

1 solution

So presumably you are using a PictureBox?

Load your two images in teh constructor, and store them in class level variables:

C#
private static Image cameraOff;
private static Image cameraOn;
...
cameraOff = Image.FromFile(@"D:\Temp\Images\CameraOff.png");
cameraOn = Image.FromFile(@"D:\Temp\Images\CameraOn.png");
pictureBoxWithCamera.Image = cameraOff;
...

When you want to set the picture to the On image:
C#
pictureBoxWithCamera.Image = cameraOn;

When you want it back to Offf:
C#
pictureBoxWithCamera.Image = cameraOff;
 
Share this answer
 

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