delphi 单击最小化按钮隐藏单击托盘显示


本文整理自网络,侵删。

 

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls;

type
  TForm1 = class(TForm)
    TrayIcon1: TTrayIcon;
    procedure TrayIcon1Click(Sender: TObject);
  private
    procedure OnMinsize(var msg: twmsyscommand);
    message wm_syscommand;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.OnMinsize(var msg: twmsyscommand);
begin
  if msg.CmdType = SC_MINIMIZE then
  begin // 此处添加对最小化事件的处理过程
    Hide();
    msg.CmdType := SC_DEFAULT;
  end;
  inherited;
end;

procedure TForm1.TrayIcon1Click(Sender: TObject);
begin
  Visible := not Visible;
end;

end.

相关阅读 >>

Delphi idhttp下载html的代码(含错误处理)

Delphi中线程的释放

Delphi 数组竟然可以这样定义

Delphi treeview添加背景图片

Delphi 输入年月判断天数

crc32.pas

Delphi程序禁止结束进程

Delphi 回车 选择下一个控件

Delphi 在tedit中显示水印提示

Delphi中动态加载image控件图片的方法

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



打赏

取消

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

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

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

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

评论

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