Showing posts with label Track bar. Show all posts
Showing posts with label Track bar. Show all posts

Use Track Bar to Change the Font Size of the label Dynamically

Change the Font Size Dynamically of the Label by drag the Track Bar

Drag and drop one Label(Name - lblDisply) & one Track Bar
Then Write the coding in TrackBar1_Scroll() Event.


Code :
    Public Class frmUseTrackBar

        Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
            lblDisply.Font = New System.Drawing.Font("Microsoft Sans Serif", (9 + CType(TrackBar1.Value, Double)), System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
            ' 9 + CType(TrackBar1.Value, Double) : 9 - For Intial Font Size. TrackBar1.Value - Increase the Font size using this value
        End Sub

    End Class