Delphi win10系统通知 NotificationCenter1 基本用法


本文整理自网络,侵删。

 

需要组件:NotificationCenter1

 

 

演示:

 

procedure TNotificationsForm.btnCancelAllClick(Sender: TObject);

begin

  NotificationCenter1.CancelAll;

end;

 

procedure TNotificationsForm.btnCancelAnotherClick(Sender: TObject);

begin

  NotificationCenter1.CancelNotification('Windows10通知2');

end;

 

procedure TNotificationsForm.btnCancelClick(Sender: TObject);

begin

  NotificationCenter1.CancelNotification('Windows10通知');

end;

 

procedure TNotificationsForm.btnShowAnotherClick(Sender: TObject);

var

  MyNotification: TNotification;

begin

  MyNotification := NotificationCenter1.CreateNotification;

  try

    MyNotification.Name := 'Windows10通知2';

    MyNotification.Title := 'Windows 10 通知 #2';

    MyNotification.AlertBody := 'RAD Studio 10 Seattle';

 

    NotificationCenter1.PresentNotification(MyNotification);

  finally

    MyNotification.Free;

  end;

end;

 

procedure TNotificationsForm.btnShowClick(Sender: TObject);

var

  MyNotification: TNotification;

begin

  MyNotification := NotificationCenter1.CreateNotification;

  try

    MyNotification.Name := 'Windows10通知';

    MyNotification.Title := 'Windows 10 通知 #1';

    MyNotification.AlertBody := 'RAD Studio 10 Seattle';

 

    NotificationCenter1.PresentNotification(MyNotification);

  finally

    MyNotification.Free;

  end;

end;

 

 

procedure TNotificationsForm.NotificationCenter1ReceiveLocalNotification(

  Sender: TObject; ANotification: TNotification);

begin

  mmLog.Lines.Add('收到的通知: ' + ANotification.Name);

end;

 

相关阅读 >>

Delphi文件操作所涉及的一些函数

Delphi xe5 json与Delphi object的互换

Delphi中窗体的事件

Delphi的unicode与gb2312转转换,汉字unicode转gb2312

Delphi 使用onvalidate事件或onvalidating事件验证在输入字段(tedit)中输入的值

Delphi 中showmodal与show的区别

Delphi外挂编写

Delphi 7 中的随机函数

Delphi 在listview控件中绘底图

Delphi 时间转换为gmt格式

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



打赏

取消

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

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

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

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

评论

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

    暂无评论...