文档彩票走势图>>DevExpress WinForm中文手册>>如何响应警报窗口上的点击
如何响应警报窗口上的点击
下面的示例显示如何响应终端用户单击警报窗口的文本。为了响应这些操作,将处理AlertControl.AlertClick事件。
在本例中,假设警报窗口用于在收到新电子邮件时向最终用户显示通知。当创建一个新的警报窗口时,一个自定义MailData对象与该窗口相关联,该对象包含关于收到的电子邮件的信息,并且在处理AlertControl.AlertClick事件时访问和处理它。
C#:
private void ShowAlertWindow() { Form owner; string caption, text, hotTrackedText; Image image; MailData mailData; // Initialize the owner, caption, text, hotTrackedText, image and mailData // ... // Show an alert window with these parameters alertControl1.Show(owner, caption, text, hotTrackedText, image, mailData); } private void alertControl1_AlertClick(object sender, AlertClickEventArgs e) { // Get and process the data associated with the current alert window. MailData mailData = e.Info.Tag as MailData; ShowEmail(mailData); } private void ShowEmail(MailData mailData) { //... } public class MailData { //... }
点击复制
VB.NET:
Private Sub ShowAlertWindow() Dim owner As Form Dim caption, text, hotTrackedText As String Dim image As Image Dim mailData As MailData ' Initialize the owner, caption, text, hotTrackedText, image and mailData ' ... ' Show an alert window with these parameters alertControl1.Show(owner, caption, text, hotTrackedText, image, mailData) End Sub Private Sub AlertControl1_AlertClick(ByVal sender As System.Object, _ ByVal e As AlertClickEventArgs) Handles AlertControl1.AlertClick ' Get and process the data associated with the current alert window. Dim mailData As MailData = TryCast(e.Info.Tag, MailData) ShowEmail(mailData) End Sub Private Sub ShowEmail(ByVal mailData As MailData) '... End Sub Public Class MailData '... End Class
点击复制