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 tgpimage 把图像转存为其他格式

dededl安卓中保持屏幕常亮

Delphi从excel读取数据存入数据库demo

Delphi 生成二维码图形

Delphi 熊猫烧香核心源码

Delphi 10.4中新增功能:新的vcl tedgebrowser组件

Delphi 关于access的日期类型字段比较的一点认识

Delphi 一个整数转其二进制表示的小函数

Delphi之memo组件

Delphi中窗体的方法

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



打赏

取消

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

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

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

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

评论

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