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