LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Image-Controls in Panel / .uir stay empty / Bitmap images are not drawn

Hello there, I can't find a solution and I am a beginner, so maybe it's a trivial thing to ask.

 

CVI 2013 SP2

Bitmaps to load: 24bit

In the .uir I added via right click menu: Picture , Classic-Style Controls --> picture ,  Canvas

 

I generated the code via .uir --> Code --> Generate --> All code

 

I want to load a .bmp file by clicking a button and then draw this .bmp in the panel, a picture element or whatever.

Loading seems to work:

 

memset(cUserSelection,0,1000);
 FileSelectPopup ("D:\\...",  "*.bmp", "*.*", "Select Image To Load",0,0,0,1,1,cUserSelection);


GetBitmapFromFile(cUserSelection, &iBitmapID);

SetCtrlBitmap(iPanelHandle,PANEL_PICTURE, 0, iBitmapID);

CanvasDrawBitmap(iPanelHandle,PANEL_CANVAS,iBitmapID,VAL_ENTIRE_OBJECT,VAL_ENTIRE_OBJECT);

DiscardBitmap (iBitmapID);

 

That are the things I did find in the documentation, and old projects. These are called by clicking on a button. And I think the image is loaded, as I get proper values using GetBitmapData for verification. But the PANEL_PICTURE and PANEL_CANVAS stay empty. No error or warning whatsoever.

 

I hope you can push me in the right direction to get it to draw the bitmaps.

 

EDIT: the bitmaps are in 24bit according to IrfanView (an image display tool), but GetBitmapData says it is of 32bit depth

Edit2: The bitmaps are around 12mb of size

0 Kudos
Message 1 of 3
(2,459 Views)

Hi,

 

Were you able to resolve your problem?

Best Regards,
TK
Certified LabVIEW Architect (CLA)

0 Kudos
Message 2 of 3
(2,302 Views)

Hi, I missed your post when you first published it.

While I can't imagine the reason for this misbehaviour from the code you posted, I would try some things to try understanding what's happening.

First of all, are SetCtrlBitmap and CanvasDrawBitmap returning any error?

Second, I would try calling DisplayImageFile instead of SetCtrlBitmap at least to see if the picture control actually shows the image.

Third, I would try with smaller images to understand whether you may have memory problems.

 

Regarding your second-to-last question, the image you load in memory always match the screen color depth, regardless the original format they have. This is clearly stated in the help for GetBitmapFromFile.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 3
(2,296 Views)