Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Win32 (http://www.go4expert.com/forums/win32/)
-   -   How to load the different images in the picture box? (http://www.go4expert.com/forums/load-images-picture-box-t2616/)

Nishant Desai 19Jan2007 17:01

How to load the different images in the picture box?
 
Dear Shabbir,

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

Nishant Desai 19Jan2007 17:32

Re: How to load the different images in the picture box?
 
Quote:

Originally Posted by Nishant Desai
Dear Shabbir,

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?

Thanks,
Nishant

shabbir 19Jan2007 18:13

Re: How to load the different images in the picture box?
 
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.

Nishant Desai 19Jan2007 19:47

Re: How to load the different images in the picture box?
 
Quote:

Originally Posted by shabbir
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?

Thanks,
Nishant

shabbir 19Jan2007 22:36

Re: How to load the different images in the picture box?
 
Both are possible. See the LoadBitmap function of the SDK where you have the option of amy bmp's to be loaded.

Nishant Desai 20Jan2007 09:43

Re: How to load the different images in the picture box?
 
Quote:

Originally Posted by shabbir
Both are possible. See the LoadBitmap function of the SDK where you have the option of amy bmp's to be loaded.

Hiii,
I ahve put the .bmp file in my current directory of the project and it is running now.
Thanks,
Nishant


All times are GMT +5.5. The time now is 12:12.