Delphi 简单实习窗体靠边隐藏


本文整理自网络,侵删。

 
  private
    { Private declarations }
    Procedure OnMove(Var Message:TMessage);  Message WM_MOVE;
  public
    { Public declarations }
  end;


Procedure TForm_Main.OnMove(Var Message:TMessage);
begin
  If GetWindowRect(Form_Main.Handle, lpRect) And (Metrics.X > 0) And (Metrics.Y > 0) Then
  begin
    if lpRect.Left < 30 then
    begin
      Form_Main.Left := 0 - (Form_Main.Width - 10);  //左隐藏
    end Else
    if (Metrics.X - lpRect.Right) < 30 then
    begin
      Form_Main.Left := Metrics.X - 10;   //又隐藏
    end Else
    if lpRect.Top < 30 then
    begin
      Form_Main.Top := 0 - (Form_Main.Height - 10);  //上隐藏
    end Else
    if (Metrics.Y - lpRect.Bottom) < 30 then
    begin                                        //下隐藏
      Form_Main.Top := Metrics.Y - 60;
    end;
  end;
end;

来源:https://www.7xcode.com/archives/93.html

相关阅读 >>

Delphi 访问https图片

Delphi获取系统字体列表

Delphi winapi: openprocess、getexitcodeprocess、terminateprocess (qq)

Delphi program name、process id、window handle、process handle 的转换函数

Delphi 系统服务运行桌面用户指定程序

Delphi 数字转换成中文

Delphi 动态修改显示器分辨率

Delphi xe将图标和图像添加为资源

Delphi 获取指定当前目录下指定文件扩展名所有文件

Delphi winapi: getactivewindow - 获取当前活动窗口的句柄

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...