Example 1
![]() Design View |
![]()
|
Setting the initial values trigger the ValueChanged event
Sub frmMain_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.ActivatedPrivate
When the ValueChanged event fires, update the form's background color and display the color value
Private Sub hsbGreen_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles hsbGreen.ValueChanged
Me.BackColor = Color.FromArgb(hsbRed.Value, hsbGreen.Value, hsbBlue.Value)
lblG.Text = Format(hsbGreen.Value, "##0")End Sub
Change the Image property value from the appropriate hidden picture control
Private Sub optMouse_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles optMouse.Click
picPicture.Image = picMouse.ImageEnd Sub
Set the Visible property of the Group control to display or hide all of the group's contents
Private
Sub chkNumbers_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkNumbers.CheckedChanged
grpNumbers.Visible = chkNumbers.CheckStateEnd Sub
Example 2
![]() |
![]() |
Using the Anchor and Dock properties
Toggling the Timer
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
End Sub
Private Sub btnToggle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnToggle.ClickEnd Sub
Example 3
Setting Font Properties
Dim myStyle As New FontStyle()
myStyle = lblMessage.Font.Style
myStyle = IIf(chkItalic.CheckState = CheckState.Checked, myStyle Or
FontStyle.Italic, myStyle And Not
FontStyle.Italic)
Dim myFont As
New Font(lblMessage.Font, myStyle)
lblMessage.Font = myFont
Setting up Tool Tips
Dim myToolTip As New ToolTip()
myToolTip.SetToolTip(lblMessage, "This is a
label")
myToolTip.SetToolTip(chkBold, "Check to set the label to
Bold")
myToolTip.SetToolTip(chkItalic, "Check to set the label to
Italic")
myToolTip.SetToolTip(chkUnderline, "Check to set the label to
Underline")
myToolTip.SetToolTip(btnDefault, "Click or Press
<Enter>")
myToolTip.SetToolTip(btnExit, "Click or Press <ESC>")
chkBold.Focus()
chkBold.Show()
Assignment
Problem 2.2
Flag Viewer