10-01-2017, Saat: 15:59
Merhaba;
Bildiğiniz gibi Image nesnesinin doğal Pan ve Zoom özelliği henüz yok. (İlerleyen sürümlerde olur İnşallah) Her iki özelliği kullanabilmek için aşağıdaki işlem adımlarını takip ederek projenize entegre edebilirsiniz.
Image nesnesinin Pan ve Zoom işlemleri için;
1- Forma bir adet GestureManager ve bir Image nesnesi yerleştirin.
2- Image nesnesine herhangi bir resim ekleyin.
3- Object Inspector'dan Formun Touch>GestureManager özelliğinde GestureManager1'i seçin.
4- Object Inspector'dan Formun Touch>InteractiveGestures özelliğinin Zoom ve Pan özelliğini True yapın.
5- projenin private bölümünde aşağıdaki tanımlamaları yapın;
6- Formun OnGesture olayında aşağıdaki kodları yazın.
Sonuç;

İyi çalışmalar
Bildiğiniz gibi Image nesnesinin doğal Pan ve Zoom özelliği henüz yok. (İlerleyen sürümlerde olur İnşallah) Her iki özelliği kullanabilmek için aşağıdaki işlem adımlarını takip ederek projenize entegre edebilirsiniz.
Image nesnesinin Pan ve Zoom işlemleri için;
1- Forma bir adet GestureManager ve bir Image nesnesi yerleştirin.
2- Image nesnesine herhangi bir resim ekleyin.
3- Object Inspector'dan Formun Touch>GestureManager özelliğinde GestureManager1'i seçin.
4- Object Inspector'dan Formun Touch>InteractiveGestures özelliğinin Zoom ve Pan özelliğini True yapın.
5- projenin private bölümünde aşağıdaki tanımlamaları yapın;
private FEnSonKonum: TPointF; FEnSonMesafe: Integer;
6- Formun OnGesture olayında aşağıdaki kodları yazın.
var LObj: IControl; LImage: TImage; LImageMerkez: TPointF; begin //Zoom için if EventInfo.GestureID = igiZoom then begin LObj := Self.ObjectAtPoint(ClientToScreen(EventInfo.Location)); if LObj is TImage then begin if (not(TInteractiveGestureFlag.gfBegin in EventInfo.Flags)) and (not(TInteractiveGestureFlag.gfEnd in EventInfo.Flags)) then begin LImage := TImage(LObj.GetObject); LImageMerkez := LImage.Position.Point + PointF(LImage.Width / 2, LImage.Height / 2); LImage.Width := LImage.Width + (EventInfo.Distance - FEnSonMesafe); LImage.Height := LImage.Height + (EventInfo.Distance - FEnSonMesafe); LImage.Position.X := LImageMerkez.X - LImage.Width / 2; LImage.Position.Y := LImageMerkez.Y - LImage.Height / 2; end; FEnSonMesafe := EventInfo.Distance; end; end; //Pan için if EventInfo.GestureID = igiPan then begin LObj := Self.ObjectAtPoint(ClientToScreen(EventInfo.Location)); if LObj is TImage then begin if not(TInteractiveGestureFlag.gfBegin in EventInfo.Flags) then begin LImage := TImage(LObj.GetObject); LImage.Position.X := LImage.Position.X + (EventInfo.Location.X - FEnSonKonum.X); LImage.Position.Y := LImage.Position.Y + (EventInfo.Location.Y - FEnSonKonum.Y); end; FEnSonKonum := EventInfo.Location; end; end; end;
Sonuç;

İyi çalışmalar
DelphiCan'dır!


Vakitsizlikten paylaşamıyorum böyle şeyleri sayenizde herkes yararlanabiliyor.