我想拥有自己的标题栏,因此我基本上使用一个面板(名称:pnCaption)并删除CreateParams中的原始标题栏.但是在新面板中通过MouseDown-MouseMove移动窗口的能力是个问题.
通常你会使用NCHITTEST消息.但如果鼠标位于面板上(我自己的标题),则不会发出此信号.看代码......
procedure TForm1.CreateParams(var params: TCreateParams);
begin
inherited Createparams(Params);
with Params do
Style := (Style or WS_POPUP) and (not WS_DLGFRAME);
end;
procedure TForm1.WM_NCHitTest(var Msg: TWMNcHitTest);
begin
inherited;
if PtInRect(pnCaption.BoundsRect, ScreenToClient(Point(Msg.XPos, Msg.YPos)))
then Msg.Result := HTCAPTION;
end;
Run Code Online (Sandbox Code Playgroud)
我将不胜感激任何提示如何完成这项任务.
基督教
delphi ×1