vb.net

位置:IT落伍者 >> vb.net >> 浏览文章

VB.net2008精彩实例,窗体应用技巧[2]


发布日期:2018年08月20日
 
VB.net2008精彩实例,窗体应用技巧[2]

相关的属性设置如下

TrackBar Value属性:

TickFrequency: 属性:

Maximum属性:

Label Text属性: 选择窗体的透明度:

Timer Interval属性:

进入代码编辑器输入代码

首先进行声明

Public Class Form

Inherits SystemWindowsFormsForm

Dim tps As Integer

Dim bol As Boolean

进入TrackBar_Scroll事件

Private Sub TrackBar_Scroll(ByVal sender As Object ByVal e As SystemEventArgs) Handles TrackBarScroll

MeOpacity = TrackBarValue /

LabelText = 窗体透明度 & CStr(MeOpacity * ) & %

End Sub

进入Timer_Tick事件

Private Sub Timer_Tick(ByVal sender As Object ByVal e As SystemEventArgs) Handles TimerTick

If bol = False Then

tps = tps +

MeOpacity = tps /

If MeOpacity >= Then

TimerEnabled = False

bol = True

End If

Else

tps = tps

MeOpacity = tps /

If MeOpacity <= Then

TimerEnabled = False

bol = False

End If

End If

End Sub

进入Form_Load事件

Private Sub Form_Load(ByVal sender As SystemObject ByVal e As SystemEventArgs) Handles MyBaseLoad

TimerEnabled = True

End Sub

进入Form_Closing事件

Private Sub Form_Closing(ByVal sender As Object ByVal e As SystemComponentModelCancelEventArgs) Handles MyBaseClosing

TimerEnabled = True

If MsgBox(你确实要关闭窗体吗? MsgBoxStyleOkCancel) = MsgBoxResultOk Then

eCancel = False

Else

TimerEnabled = False

MeOpacity =

tps =

bol = True

eCancel = True

End If

End Sub

创建完成后我们来运行程序测试一下测试成功程序窗体是不是变得透明了通过调节滚动条我们甚至可以使得窗体消失达到完全隐形的目的这是不是很神奇呢?

[] []

               

上一篇:VB.net2008精彩实例,窗体应用技巧[1]

下一篇:vb.net通过app.config来改变编译路径