熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

VB.net2008精彩實例,窗體應用技巧[2]

2013-11-13 10:47:18  來源: .NET編程 

  相關的屬性設置如下

  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

  創建完成後我們來運行程序測試一下測試成功程序窗體是不是變得透明了通過調節滾動條我們甚至可以使得窗體消失達到完全隱形的目的這是不是很神奇呢?

[]  []  


From:http://tw.wingwit.com/Article/program/net/201311/14510.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.