Archicad C++ API
About Archicad add-on development using the C++ API.

[SOLVED] How to dynamically load a picture

Anonymous
Not applicable
Hello

I need to have a picture in my add-on dialog.
Is there a way to dynamically load pictures from file system.
2 REPLIES 2
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi,

you can use GX::Image to dynamically load pictures from file.
// Example code to dynamic load image: 
 
IO::Location locationToPic ("<path string to the picture file>"); 
const void* dgPicture = GX::Image (locationToPic).ToDGPicture (); 
DGSetItemImage (<DIALOG_ID>, <PIC_ITEM_ID>, DG::Picture (dgPicture));  
// or with C++ interface DG::PictureItem use SetPicture (DG::Picture (dgPicture))
// In the dialog's resource you must define a Picture item and should define a default picture in the fix GRC 
 
'GBMP'	<DEFAULT_PIC_RESID>	"default_picture" { 
	"default_picture" 
} 
 
'GDLG'  <DIALOG_ID>    Modal    0    0  210  210  "Dialog with picture" { 
/* [<PIC_ITEM_ID>] */ Picture			  10   10   200   200  <DEFAULT_PIC_RESID>	ClientEdge 
/* [          ...] */  
}


Best Regards,
Tibor
Anonymous
Not applicable
Thank you for the answer Tibor.
This is what I needed!

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!