Page 1 of 1

move a image on a image control

PostPosted: Wed Jun 17, 2015 7:39 pm
by Silvio.Falconi
When I load an image into a image control it put the image at the left angle as you can see on this picture

Image

how I can make to move the image at center of image control ?

Re: move a image on a image control

PostPosted: Thu Jun 18, 2015 7:15 am
by Antonio Linares
Please provide a small and self contained example to see how you are doing it, thanks

Re: move a image on a image control

PostPosted: Thu Jun 18, 2015 8:04 am
by nageswaragunupudi
Use TXImage

Re: move a image on a image control

PostPosted: Thu Jun 18, 2015 4:00 pm
by Silvio.Falconi
@ 1, 0 IMAGE oImage SIZE 250, 250 OF oAllegati SCROLL

Local cPdfImage :=".\bitmaps\files\1.bmp"
oImage:LoadBmp( cPdfImage )



Mr Rao I not Have tximage I have jannuary 20115 version of fwh

Re: move a image on a image control

PostPosted: Thu Jun 18, 2015 4:06 pm
by ukoenig
Silvio,

my testtool :
Image centered on defined image.
Alpha on JPG and jpg on jpg ( or other formats )
select any combination of image 1 and image 2

Download ( complete with exe, prg and images ) :
http:((http://www.pflegeplus.com/DOWNLOADS/Center2.zip

Images to be loaded from the subdirectory /IMAGES

Image

Image

Image

best regards
Uwe :)

Re: move a image on a image control

PostPosted: Thu Jun 18, 2015 5:20 pm
by Silvio.Falconi
thanks uwe

the image is on the center now
but I have a problem

I have 3 button s when I can change the zoom of image
if I use your function I cannot change the zoom of oImage because your function recreate another object

Re: move a image on a image control

PostPosted: Thu Jun 18, 2015 5:39 pm
by ukoenig
Silvio,

what image do You want to zoom ?
the main-image-area or the centered image ?

best regards
Uwe :?:

Re: move a image on a image control

PostPosted: Thu Jun 18, 2015 6:05 pm
by Silvio.Falconi
Uwe,
I use this function



@ 0, 0 IMAGE oImage SIZE 250, 250 OF oDlg SCROLL


@ 230,275 BTNBMP obtn[1] PROMPT "A" of oDlg SIZE 15,10 NOBORDER PIXEL ACTION AjustaZoom(oImage,"S",oSay[7])
@ 230,295 BTNBMP obtn[2] PROMPT "Z-" of oDlg SIZE 15,10 NOBORDER PIXEL ACTION AjustaZoom(oImage,"R",oSay[7])
@ 230,315 BTNBMP obtn[3] PROMPT "Z+" of oDlg SIZE 15,10 NOBORDER PIXEL ACTION AjustaZoom(oImage,"A",oSay[7])



Function AjustaZoom(oBmp,cAccion,oSay)
local nZoom:=oBmp:Zoom()

do case
case cAccion == "S"
oBmp:lStretch := !oBmp:lStretch
oBmp:ScrollAdjust()
oBmp:Refresh( .t. )
oChk[2]:refresh()

case cAccion == "R"
if nZoom*10>1
oBmp:lStretch := .f.
nZoom:=nZoom-(0.10)
oBmp:Zoom(nZoom)
oBmp:Refresh()
oBmp:ScrollAdjust()
oChk[2]:refresh()

endif
case cAccion == "A"
oBmp:lStretch := .f.
nZoom:=nZoom+0.10
oBmp:Zoom(nZoom)
oBmp:Refresh()
oBmp:ScrollAdjust()
oChk[2]:refresh()

endcase

if oBmp:lStretch
oSay:SetText(Oemtoansi("Immagine allargata"))
else
oSay:SetText(Oemtoansi( "Zoom immagine...: "+alltrim(str(nZoom*100,10,0))+"%"))
endif

return NIL

Re: move a image on a image control

PostPosted: Fri Jun 19, 2015 11:30 am
by ukoenig
Added ZOOM on buttonaction.
is it the solution, You are looking for`?

Image

Image

best regards
Uwe :?: