1.引用单元
uses Winapi.Windows, FMX.Platform.Win, Winapi.Messages;
2.发送消息
//发送系统消息
SendMessage(FmxHandleToHwnd(Handle), WM_SYSCOMMAND,SC_MOVE + HTCAPTION, 0);
网上说要用ReleaseCapture(),我没有用也可以,没细看为什么。
我看了一下ReleaseCapture()与StartWindowDrag,其实都是取坐标用的。
3.实例代码
unit Unit1; interface uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Objects; type
TForm1 = class(TForm)
Image1: TImage;
procedure Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Single);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; var
Form1: TForm1; implementation
uses Winapi.Windows, FMX.Platform.Win, Winapi.Messages;
{$R *.fmx} procedure TForm1.FormShow(Sender: TObject);
begin
Self.BorderStyle := TFmxFormBorderStyle.None; //窗体样式
Image1.WrapMode := TImageWrapMode.Stretch; //图片加载方式
end; procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Single);
begin
//发送系统消息
SendMessage(FmxHandleToHwnd(Handle), WM_SYSCOMMAND,SC_MOVE + HTCAPTION, );
end; end.