文檔首頁(yè)>>DevExpress WinForm中文手冊(cè)>>如何使警告窗口不透明
如何使警告窗口不透明
此示例顯示一個(gè)警報(bào)窗口,并演示如何響應(yīng)單擊警報(bào)窗口的內(nèi)容,顯示的警告窗口在BeforeFormShow事件處理程序中是不透明的。
Form1.cs:
using DevExpress.XtraEditors; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace ShowAlertWindow { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void simpleButton1_Click(object sender, EventArgs e) { Message msg = new Message(); alertControl1.Show(this, msg.Caption, msg.Text, "", msg.Image, msg); } private void alertControl1_BeforeFormShow(object sender, DevExpress.XtraBars.Alerter.AlertFormEventArgs e) { //Make the Alert Window opaque e.AlertForm.OpacityLevel = 1; } private void alertControl1_AlertClick(object sender, DevExpress.XtraBars.Alerter.AlertClickEventArgs e) { //Process Alert Window click Message msg = e.Info.Tag as Message; XtraMessageBox.Show(msg.Text, msg.Caption); } } public class Message { public Message() { this.Caption = "LILA-Supermercado"; this.Text = "Carrera 52 con Ave. Bolívar #65-98 Llano Largo"; this.Image = global::ShowAlertWindow.Properties.Resources.opportunities_32x32; } public string Caption { get; set; } public string Text { get; set; } public Image Image { get; set; } } }
點(diǎn)擊復(fù)制
Form1.vb:
Imports DevExpress.XtraEditors Imports System Imports System.Collections.Generic Imports System.ComponentModel Imports System.Data Imports System.Drawing Imports System.Linq Imports System.Text Imports System.Threading.Tasks Imports System.Windows.Forms Namespace ShowAlertWindow Partial Public Class Form1 Inherits Form Public Sub New() InitializeComponent() End Sub Private Sub simpleButton1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles simpleButton1.Click Dim msg As New Message() alertControl1.Show(Me, msg.Caption, msg.Text, "", msg.Image, msg) End Sub Private Sub alertControl1_BeforeFormShow(ByVal sender As Object, ByVal e As DevExpress.XtraBars.Alerter.AlertFormEventArgs) Handles alertControl1.BeforeFormShow 'Make the Alert Window opaque e.AlertForm.OpacityLevel = 1 End Sub Private Sub alertControl1_AlertClick(ByVal sender As Object, ByVal e As DevExpress.XtraBars.Alerter.AlertClickEventArgs) Handles alertControl1.AlertClick 'Process Alert Window click Dim msg As Message = TryCast(e.Info.Tag, Message) XtraMessageBox.Show(msg.Text, msg.Caption) End Sub End Class Public Class Message Public Sub New() Me.Caption = "LILA-Supermercado" Me.Text = "Carrera 52 con Ave. Bolívar #65-98 Llano Largo" Me.Image = My.Resources.opportunities_32x32 End Sub Public Property Caption() As String Public Property Text() As String Public Property Image() As Image End Class End Namespace
點(diǎn)擊復(fù)制