加入ApplicationEvents控件
procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
begin
if (Msg.message = WM_RBUTTONDOWN) and (msg.hwnd =form1.handle) then
begin
Handled := True;
if image1.Picture.Bitmap.Empty then
image1.OnContextPopup(Self,Mouse.CursorPos,Handled);
end;
end;