stu nicholls dot com | menu - Professional dropdown #3



StatusStrip:

This control displays information to the user about the object being viewed, the object’s components or the object’s operation.
StatusStrip control is added to the Form. Now from the properties of StatusStrip select Items. You will get the Items Collection Editor, using which you can add and remove the collection of items to be displayed on the ToolStrip which is shown in Fig. 63. Application is executed and the resulting screen is shown in Fig. 64.

Fig63



Program to use StatusStrip which displays the User and the System date:

Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.ToolStripStatusLabel2.Text = My.User.Name
Me.ToolStripStatusLabel4.Text = Now.ToLongDateString.ToString
End Sub
End Class
Fig64



TrackBar:

TrackBar controls let the user specify a magnitude by scrolling a selector between its minimum and maximum values. it doesn’t cover a continuous range of values. The TrackBar control has a fixed number of tick marks, which the developer can label. Users can place the slider’s indicator to the desired value.
Following program is written to implement the TrackBar control. Fig. 65 shows the design of the form and Fig. 66 shows the result after execution of the application. Program is written to change the back ground color of the form.
Program to Implement the TrackBar Control

Public Class Trackbar
Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll, TrackBar2.Scroll, TrackBar3.Scroll
Me.BackColor = Color.FromArgb(TrackBar1.Value, TrackBar2.Value, TrackBar3.Value)
' TrackBar1.Value Passes Red Color Value
' TrackBar2.Value Passes Green Color Value
' TrackBar3.Value Passes Blue Color Value
End Sub
End Class
Fig65



Fig66



Scroll Bars:

The Scroll Bar controls display vertical and horizontal scroll bars on the form. Scroll Bars provide an intuitive way for navigating through large amount of information. Two types of scroll bar controls are available and they are: HScrollBar for horizontal scroll bars and VScrollBar for vertical scroll bars. Both of these controls are used independently from each other.
In the following application both the Scroll Bar controls HScollBar and VScrollBar is placed. As you drag through the HScrollBar the horizontal area covered by it is displayed in the text box below it and when you drag through the VScrollBar the vertical area covered by it is displayed in the text box besides it. The button whose text is shown as Rectangle will change its shape depending on the total area covered by both the HScrollBar and VScrollBar. When you click the button Area the value of the total area covered by the button Rectangle is displayed in the text box beneath the button Area. Fig. 67 shows the design of the form and Fig. 68 shows the screen after the execution of the application.
Fig67



Fig68



Program for Scroll Bars

Public Class Scrollbar
Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll
Me.rectangle.Width = Me.HScrollBar1.Value
Me.txtwidth.Text = Me.HScrollBar1.Value
End Sub

Private Sub VScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles VScrollBar1.Scroll
Me.rectangle.Height = Me.VScrollBar1.Value
Me.txtheight.Text = Me.VScrollBar1.Value
End Sub

Private Sub btnarea_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnarea.Click
Me.txtarea.Text = Val(Me.txtheight.Text) * Val(Me.txtwidth.Text)
End Sub
End Class

<< Previous   Next>>


comments powered by Disqus
click here
Footer1