大家好,我想用c++builder來實作對圖片的雙指縮放功能,即用互動手勢實作,只找到一些delphi的代碼,怎么移植一下呢?
謝謝大家
var
FLastDIstance: Integer;
procedure TForm1.FormGesture(Sender: TObject;
const EventInfo: TGestureEventInfo; var Handled: Boolean);
var
LObj: IControl;
LWeb: TWebBrowser;
begin
LObj := Self.ObjectAtPoint(ClientToScreen(EventInfo.Location));
if LObj is TWebBrowser then
begin
if (not (TInteractiveGestureFlag.gfBegin in EventInfo.Flags)) and (not (TInteractiveGestureFlag.gfEnd in EventInfo.Flags)) then
begin
{ zoom the WebBrowser }
LWeb := TWebBrowser(LObj.GetObject);
LWeb.Width := LWeb.Width + 2 * ((EventInfo.Distance - FLastDIstance) / 3);
LWeb.Height := LWeb.Height + 2 * ((EventInfo.Distance - FLastDIstance) / 3);
LWeb.Position.X := LWeb.Position.X - (EventInfo.Distance - FLastDIstance) / 3;
LWeb.Position.Y := LWeb.Position.Y - (EventInfo.Distance - FLastDIstance) / 3;
end;
FLastDistance := EventInfo.Distance;
end;
end;
uj5u.com熱心網友回復:
if (not (TInteractiveGestureFlag.gfBegin in EventInfo.Flags)) and (not (TInteractiveGestureFlag.gfEnd in EventInfo.Flags))主要是這句怎么轉換呢,沒有相應的陳述句呀,頭檔案
uj5u.com熱心網友回復:
if((EventInfo.Flags.Contains(TInteractiveGestureFlag::gfBegin)==false) && (EventInfo.Flags.Contains(TInteractiveGestureFlag::gfEnd)==false))
uj5u.com熱心網友回復:
uj5u.com熱心網友回復:
這個是不是一些控制元件自己帶了?轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/105713.html
標籤:VCL組件使用和開發
下一篇:為什么擦除背景就不行,不理解
