文檔半島外圍網上直營>>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
點擊復制

 QQ交談
QQ交談 在線咨詢
在線咨詢 
                 
                
 渝公網安備
            50010702500608號
渝公網安備
            50010702500608號
             
            
 客服熱線
客服熱線