Delphi中窗体的帮助按钮上执行一个自定义的动作

先设置BorderStyle和BorderIcons

type
   THelpForm = class(TForm)
   private
     procedure WMNCLBUTTONDOWN(var Msg: TWMNCLButtonDown) ; message WM_NCLBUTTONDOWN;
     procedure WMNCLBUTTONUP(var Msg: TWMNCLButtonUp) ; message WM_NCLBUTTONUP;
   end;

var
   HelpForm: THelpForm;

implementation
{$R *.dfm}

procedure THelpForm.WMNCLBUTTONDOWN(var Msg: TWMNCLButtonDown) ;
begin
   if Msg.HitTest = HTHELP then
     Msg.Result := 0 // "eat" the message
   else
     inherited;
end;

procedure THelpForm.WMNCLBUTTONUP(var Msg: TWMNCLButtonUp) ;
begin
   if Msg.HitTest = HTHELP then
   begin
     Msg.Result := 0;
     ShowMessage('Need help?') ;
   end
   else
     inherited;
end;
 

原文地址:https://www.cnblogs.com/martian6125/p/9631253.html