How to load the different images in the picture box?

I am a newbie to this forum, and I want to change the pictures as the boolean, by boolean mean when the variable is true, the picture box should show the green dot and if the variable is false then picturebox is false, then it should show the red dot.

I have bitmaps of both, red and green dots. but i dont know how to load them into the picture box when the event ocurs, please help me to sort out the fact.

Actually I have the big project, so i dont think that i have to create the picture box class, but i want to know that how to create the DC for the picture box, what should i write so that it creatres the DC for the picture box, i have taken.

I am a newbie to this forum, and I want to change the pictures as the boolean, by boolean mean when the variable is true, the picture box should show the green dot and if the variable is false then picturebox is false, then it should show the red dot.

I have bitmaps of both, red and green dots. but i dont know how to load them into the picture box when the event ocurs, please help me to sort out the fact.

Actually I have the big project, so i dont think that i have to create the picture box class, but i want to know that how to create the DC for the picture box, what should i write so that it creatres the DC for the picture box, i have taken.

Thanks,
Nishant

Dear Shabbir,

Your code helps me a much and it is running also, thanks for the nice article.

The problem now i am facing is that as i am loading the image i have in my project into the picture box, but instead of showin that bitmap, it shows the blank white picture on that place, what is the thing i am doing wrong?

As you said, I am giving the picPreview.SetBitmap(Image ID), ofcourse i am giving the my project's Image ID in the place of Image ID, but it is still loading as a blank, what could be the problem?

I am not sure what could be the problem as SetBitmap API should load the image (bmp)

Try running my example instead of yours and see what can go wrong in your case.

Hiii,

Ok, I will try that, but tell me is it possible to give the whole path of the Bitmap from the computer, by that i mean if my bitmap is in the C drive, then is it possible to call it from there by "C:\abc.bmp"? or is it possible to put it in the same directory of the project and to call it?