• <menu id="w2i4a"></menu>
  • logo DevExpress WinForm中文手冊

    文檔首頁>>DevExpress WinForm中文手冊>>如何響應警報窗口上的點擊

    如何響應警報窗口上的點擊


    立即下載DevExpress WinForms

    下面的示例顯示如何響應終端用戶單擊警報窗口的文本。為了響應這些操作,將處理AlertControl.AlertClick事件。

    在本例中,假設警報窗口用于在收到新電子郵件時向最終用戶顯示通知。當創(chuàng)建一個新的警報窗口時,一個自定義MailData對象與該窗口相關聯(lián),該對象包含關于收到的電子郵件的信息,并且在處理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

    點擊復制

    掃碼咨詢


    添加微信 立即咨詢

    電話咨詢

    客服熱線
    023-68661681

    TOP
    三级成人熟女影院,欧美午夜成人精品视频,亚洲国产成人乱色在线观看,色中色成人论坛 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();