Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lab 10 Slides.

Similar presentations


Presentation on theme: "Lab 10 Slides."— Presentation transcript:

1 Lab 10 Slides

2 ScrollBar TrackBar Image Rotation

3 1. ScrollBar Controls let the user specify magnitude by scrolling a selector between its minimum and maximum values. The VScrollBar lets the user move up & down a long form The HScrollBar lets the user move left & right a long form. Value Minimum Maximum Large change Small change Small change

4 2. TrackBar control Is similar to the ScrollBar , but it doesn’t cover a continuous range of values. The TrackBar control has a fixed number of tick marks, which the developer can label (e.g., Off, Slow, and Speedy ) Off Medium Fast

5 ScrollBar & TrackBar Controls
ScrollBar should be used when the exact value isn’t as important as the value’s effect on another object or data element. TrackBar should be used when the user can type a numeric ( in a specific range) integers between 0 & 100 , or a value between 0&5 inches in steps of 0.1 inch (0.0,0.1,0.2…. 0.5)

6 Controls properties Minimum : default 0.
Maximum : default But can vary. Value : current value specified by the indicator’s position.

7 Controls Events Public Sub TrackBar1_Scroll(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles TrackBar1.Scroll ' Whenever the user scrolls the TrackBar, ' this label will update to show the value lblCurrentValue.Text = TrackBar1.Value End Sub This handler is configured to update the Label used to display the current value of the TrackBar / ScrollBar control whenever the TrackBar / ScrollBar value is updated by means of scrolling.

8 Private Sub TrackBar1_ValueChanged(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles TrackBar1.ValueChanged ' This is not redundant, if you set the trackbar to some initial ' value in use, call this will synch the label and the trackbar lblCurrentValue.Text = TrackBar1.Value End Sub This subroutine updates the current value of the Label to match the TrackBar/ScrollBar control’s value whenever the TrackBar/ScrollBar control’s value changes even without scrolling the control.

9 Example- change the color of picture box using values from scrollbar
Private Sub redBar_ValueChanged(ByVal sender As Object, ByVal e As _ System.EventArgs) Handles redBar.Scroll ColorBox1() End Sub Private Sub greenBar_ValueChanged(ByVal sender As Object, ByVal e As _ System.EventArgs) Handles greenBar. Scroll Private Sub blueBar_ValueChanged(ByVal sender As Object, ByVal e As _ System.EventArgs) Handles blueBar. Scroll

10 Sub ColorBox1() Dim clr As Color clr = Color.FromArgb(redBar.Value, greenBar.Value, blueBar.Value) PictureBox1.BackColor = clr End Sub

11 3.Image Rotation PictureBox1.Refresh()
Use the RotateFlip method provided by class Image. It has different selections, some are: RotateFlipType.Rotate180FlipNone ‘ 180 degree rotation RotateFlipType.Rotate270FlipNone ‘ 270 degree rotation RotateFlipType.Rotate90FlipNone ‘90 degree rotation Example: PictureBox1.Image.RotateFlip(RotateFlipType.Rotate180FlipNone) To display the updated image you can do: PictureBox1.Refresh()


Download ppt "Lab 10 Slides."

Similar presentations


Ads by Google