Image拖动窗体效果演示,点击图片弹出菜单

1. Image效果1:拖动图片移动窗体

procedure TFormMain.Image_BackgroundMouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
  //=== 窗体跟着图片移动 效果 ===
  if (Button = mbLeft) then
  begin
    ReleaseCapture;
    SendMessage(handle, WM_SYSCOMMAND, SC_MOVE or 2, 0);
  end
  else
    inherited;
end;

2. Image效果2:点击图片弹出帮助菜单

procedure TFormMain.Image_HelpMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
  Point:TPoint;
begin        //=== 点击图片,弹出帮助菜单 ===
  Point.x := Image_Help.Left + 15;
  Point.y := Image_Help.top + Image_Help.Height + 25;
  Point   := ClientToScreen(Point);
  if Button=mbLeft then
  HelpPopup.popup(Point.x, Point.y);
end;

3. 打开chm帮助文档

const
  SHelpFile = 'Help\Image演示程序.chm';

begin
{$IFDEF DEBUG}
  ReportMemoryLeaksOnShutdown := True;
{$ENDIF}
  Application.Initialize;
  //=== 设置帮助文档 ===
  Application.HelpFile := SHelpFile;
  //=== 加上这句代码,任务栏中的右键菜单没有了 ===
//  Application.MainFormOnTaskbar := True;
  Application.CreateForm(TFormMain, FormMain);
  Application.Run;
end.

procedure TFormMain.HelpTopicClick(Sender: TObject);
begin
  //=== 打开帮助文档 ===
  HtmlHelp(Application.Handle, Application.HelpFile, HH_DISPLAY_TOC, 0);
end;

下载源代码: ImageDemo.rar



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值