VB.NET通知控件基本概念解析
VB.NET開發(fā)語言的出現(xiàn)為我們帶來了非常大的好處。今天我們會(huì)從VB.NET通知控件的一些基本概念來對(duì)這款語言進(jìn)行一個(gè)詳細(xì)的了解,希望可以對(duì)又需要的朋友有所幫助,提高大家的認(rèn)知程度。
VB.NET通知控件有兩個(gè)基本的類組成:
一個(gè) form (會(huì)實(shí)際顯示出來的部分). 一個(gè)包含所有可在form中包含的屬性的類.
類包含兩個(gè)timers, 一個(gè)用來控制漸隱漸出的動(dòng)畫效果,另一個(gè)可配置為定義彈出窗口顯示多久.下面是一個(gè)演示:
- fPopup.Size = Size
- fPopup.Opacity = 0
- fPopup.Location = _ New
Point(Screen.PrimaryScreen.
WorkingArea.Right_ -
fPopup.Size.Width - 1,- _ Screen.PrimaryScreen.
WorkingArea.Bottom)- fPopup.Show()
form在Paint事件中完成繪制. 筆者使用了一下函數(shù)來獲取比指定顏色更淺/更深的顏色,但不確定是否有更好的方法.
- Private Function GetDarkerColor()
- Function GetDarkerColor(ByVal
Color As Color) As Color- Dim clNew As Color clNew =
Drawing.Color.FromArgb(255,
DedValueMin0(CInt(Color.R), _
Parent.GradientPower), DedValueMin0
(CInt(Color.G), _ Parent.GradientPower),
DedValueMin0(CInt(Color.B), _
Parent.GradientPower))- Return clNew
- End
- Function
- 為避免閃爍: Me.SetStyle(ControlStyles.
OptimizedDoubleBuffer, True)- Me.SetStyle(ControlStyles.
ResizeRedraw, True)- Me.SetStyle(ControlStyles.
AllPaintingInWmPaint, True)
如何為VB.NET通知控件實(shí)現(xiàn)一個(gè)隱藏窗體的方法
在PopupNotifier.vb 類中加入:
- Sub Hide()
- Sub Hide()
- tmWait.Stop()
- tmAnimation.Start()
- End Sub
在form中如此調(diào)用:
- Private Sub PopupNoti
fier1_Close()- Sub PopupNotifier1_Close()
- Handles PopupNotifier1.Close
- PopupNotifier1.Hide()
- End Sub
VB.NET通知控件的一些基本概念就為大家介紹到這里。
【編輯推薦】