dynamic graphic in g.drawpicture ?

Hello, all you great people!
I’ve been tinkering with Xojo for nearly 3 months, and I gotta say, I think I picked the right place to start learning programming.
This forum has already been of immense use for me, so here goes my 1st “official” question: (please forgive my noobishness LOL)

After struggling with trying to have a report get its data from a listbox, I gave up on the report designer, and did the whole thing using drawing methods. I’m happy with the results, but here’s my snag…I’ve designed invoice/receipt layouts, each with a small graphic (logo) in the top-left corner. No problem there. I am using the g.drawpicture method. How can I set that graphic to be called from an external source (folder on the hard drive), rather than strictly from an embedded graphic?
I would like to allow my users to browse and choose their own logo.
btw: browse and choose is not a problem…just the dynamic graphic part is.

This is the code I’m using now: (resizing a large image so I’ll have decent print quality)

g.DrawPicture(craftbox_logo2,45,30,139,95,0,0,929,630)

Is this possible?

[quote=139370:@Bill Dawson]btw: browse and choose is not a problem…just the dynamic graphic part is.

This is the code I’m using now: (resizing a large image so I’ll have decent print quality)

g.DrawPicture(craftbox_logo2,45,30,139,95,0,0,929,630)

Is this possible?[/quote]

You can use the Open method of the Picture object to load it, then use it exactly like the code you posted. The only tricky part is that you will need to take into account the proportions of the picture the user selected in your scaling to avoid aspect ratio issues.

Sure. Just use getOpenFolderitem to prompt the user to select a graphic file.

Then use picture.open(folderitem) to store the image into a picture property.

Something like this:

Dim f as folderitem = getOpenFolderitem("jpg") // you can restrict the files shown here If f <> nil then dim p as picture p = picture.open(f) g.drawPicture(p, 45, 30) End if

[quote=139373:@Marc Zeedar]Sure. Just use getOpenFolderitem to prompt the user to select a graphic file.

Then use picture.open(folderitem) to store the image into a picture property.

Something like this:

Dim f as folderitem = getOpenFolderitem("jpg") // you can restrict the files shown here If f <> nil then dim p as picture p = picture.open(f) g.drawPicture(p, 45, 30) End if[/quote]

Thanks and pantload!! I’ll have a tinker with that and see how I do…may take me a few days to get back to you, but I’ll let you know how I make out.

EUREKA!!
Thanks, Marc, you made my whole week! :slight_smile: