Insert a photo

Post Reply
Natter
Posts: 524
Joined: Mon May 14, 2007 9:49 am

Insert a photo

Post by Natter »

Hi, all !

There is an object of type TXImage. I need to insert a photo from the Clipboard into it. How could I possibly do that ?
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Insert a photo

Post by cnavarro »

Assign data lCanPaste := .T., and press button right over control TXImage

Code: Select all


   @ 300, 300 XIMAGE oImage SIZE 300, 300 ;
      OF oWnd SOURCE "ejemplo.png" NOBORDER 

   oImage:lCanPaste := .T.

 
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Natter
Posts: 524
Joined: Mon May 14, 2007 9:49 am

Re: Insert a photo

Post by Natter »

Thank you for your help !

Can I save an image from TXImage to a variable ?
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Insert a photo

Post by cnavarro »

I do not understand well
Please, explain better
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Natter
Posts: 524
Joined: Mon May 14, 2007 9:49 am

Re: Insert a photo

Post by Natter »

The TXImage class has a Save method that allows you to save the image only to a file. I need to save the image to a variable
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Insert a photo

Post by nageswaragunupudi »

hBitmap := oImage:GetHBitmap()
Regards

G. N. Rao.
Hyderabad, India
Natter
Posts: 524
Joined: Mon May 14, 2007 9:49 am

Re: Insert a photo

Post by Natter »

the GetHBitmap() function will return the handle of the picture.
I need the text of picture
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Insert a photo

Post by nageswaragunupudi »

text of picture?
Regards

G. N. Rao.
Hyderabad, India
Natter
Posts: 524
Joined: Mon May 14, 2007 9:49 am

Re: Insert a photo

Post by Natter »

I need to save the picture to BLOB. I can do this
buf=memoread ("my.jpg")
blobdirectput(0, buf)

But is it possible to do so ?
blobdirectput(0, image:GetHBitmap() )
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Insert a photo

Post by nageswaragunupudi »

BmpToStr( oImage:GetHBitmap() )
Regards

G. N. Rao.
Hyderabad, India
User avatar
Mulyadi
Posts: 77
Joined: Mon Apr 18, 2011 2:32 am

Re: Insert a photo

Post by Mulyadi »

Mr Nages,

Can you post here sample how to handle the Paste Image..?

Thanks.
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Insert a photo

Post by nageswaragunupudi »

Please set

Code: Select all

oImage:lCanPaste := .t.
 
if you want the user to paste images into the XImage control.

Then the user can
1. Copy an image from any source
2. Select the ximage by clicking on it
3) (a) Press Ctrl-V
OR
(b) Right-click on ximage and select "Paste" option from the context menu

Image

If you want to paste thorugh program, you can use oImage:Paste() even if oImage:lCanPaste is not set to .t.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Mulyadi
Posts: 77
Joined: Mon Apr 18, 2011 2:32 am

Re: Insert a photo

Post by Mulyadi »

Thanks Mr Nages.
Best Regard..
Post Reply