2014年9月28日 星期日

診間報到系統-1(DoubleBuffered)

叫號時閃爍功能不夠順暢!開啟控制項的DoubleBuffered

Public Sub New()

    ' 此為 Windows Form 設計工具所需的呼叫。
    InitializeComponent()

    ' 在 InitializeComponent() 呼叫之後加入任何初始設定。
    Me.DoubleBuffered = True
    Me.SetStyle(ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer, True)
    Me._PropertyInfo = Me.GetType().GetProperty("DoubleBuffered", System.Reflection.BindingFlags.Instance Or System.Reflection.BindingFlags.NonPublic)
    SearchControl(Me)

End Sub

Sub SearchControl(ByVal Ctrl As System.Windows.Forms.Control)

    For Each rootCtrl As System.Windows.Forms.Control In Ctrl.Controls
        Me._PropertyInfo.SetValue(rootCtrl, True, Nothing)
        If (rootCtrl.HasChildren) Then
            SearchControl(rootCtrl)
        End If
    Next

End Sub

沒有留言:

張貼留言