TrackBar:
The TrackBar control is a special slider control that allows the user to select a numeric value by changing the position of the slider.
The TrackBar is controlled mainly by three properties: Minimum, Maximum and Value.
Properties of TrackBar
Common Properties
Visually Drag Drop
Object Creation
Events
TreeView:
The TreeView control contains a hierarchy of TreeViewItem controls. It provides a way to display information in a hierarchical structure by using collapsible nodes . The top level in a tree view are root nodes that can be expanded or collapsed if the nodes have child nodes.
Properties of TreeView
Visually Drag Drop
Constructors
Object Creation
Methods( )
2. TrackBar
The TrackBar control is a special slider control that allows the
user to select a numeric value by changing the position of the
slider.
The TrackBar is controlled mainly by three properties:
Minimum, Maximum and Value.
4. Properties of TrackBar
Size: Set the height and width of the control.
BackColor: Set the back color.
Visible: Hide / show property.
Value: The by default value of TrackBar Maximum is 10
and Minimum is 0.
11. Visually Drag Drop
This will display the “New Project” dialog as shown below,
where you should follow these steps:
1. Choose “Visual C#” from the list of templates on the left hand
side of the dialog.
2. Choose the “Windows Forms Application” template from the
center list.
3. Enter a name for the project. I’m using “Track.Bar”.
4. Uncheck the “Create directory for solution” box.
12.
13. Visually Drag Drop
Clicking on “Toolbox” on the left-hand side of the window, as
shown below, will display the “Toolbox” panel. I find it
convenient when I’m designing a form to click the push-pin at
the upper right of the “Toolbox” panel so that it remains visible
and is easier to access.
The TrackBar control is not in this list and you’ll need to expand
the “All Windows Forms” and look for “TrackBar”, as shown to
the right.
14.
15. Object Creation
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TrackBar
{
20. Object Creation…Continue
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Track_Bar_with_picture_Box
{
public partial class Form1 : Form
{
24. Events
Value: The by default value of TrackBar Maximum is 10 and
Minimum is 0.
Minimum and Maximum: these two properties are used to define
the range that the thumbs can scroll over.
i.e. trackBar1.Minimum = 0;
i.e. trackBar1.Maximum = 200;
LargeTickFrequency: this property is used to set the space
between the large tick marks.
SmallTickFrequency: this property is used to set the space
between the small tick marks.
i.e. trackBar1.TickFrequency = 5;
27. TreeView
The TreeView control contains a hierarchy of TreeViewItem
controls. It provides a way to display information in a
hierarchical structure by using collapsible nodes . The top level
in a tree view are root nodes that can be expanded or collapsed if
the nodes have child nodes.
29. Properties of TreeView
BackColor: Gets or sets the background color of the tree
node.
Bounds: Gets the bounds of the tree node.
Checked: Gets or sets a value indicating whether the tree
node is in a checked state.
FirstNode: Gets the first child tree node in the tree node
collection.
ForeColor: Gets or sets the foreground color of the tree
node.
30. Properties of TreeView
FullPath: Gets the path from the root tree node to the current
tree node.
Handle: Gets the handle of the tree node.
ImageIndex: Gets or sets the image list index value of the
image displayed when the tree node is in the
unselected state.
ImageKey: Gets or sets the key for the image associated with
this tree node when the node is in an unselected state.
31. Visually Drag Drop
This will display the “New Project” dialog as shown below,
where you should follow these steps:
1. Choose “Visual C#” from the list of templates on the left hand
side of the dialog.
2. Choose the “Windows Forms Application” template from the
center list.
3. Enter a name for the project. I’m using “TreeView”.
4. Uncheck the “Create directory for solution” box.
32.
33. Visually Drag Drop
Clicking on “TreeView” on the left-hand side of the window, as
shown below, will display the “Toolbox” panel. I find it
convenient when I’m designing a form to click the push-pin at
the upper right of the “Toolbox” panel so that it remains visible
and is easier to access.
The TrackBar control is not in this list and you’ll need to expand
the “All Windows Forms” and look for “TreeView”, as shown to
the right.
36. Object Creation
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TreeView1
{
37. Object Creation…Continue
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
TreeNode tNode;
tNode = treeView1.Nodes.Add("Welcome...");
}
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
41. Methods( )
Hide( )
hide the control from the user.(Inherited from Control).
HitTest(Int32, Int32)
Provides node information, given x- and y-coordinates.
OnBackColorChanged(EventArgs)
Raises the BackColorChanged event.(Inherited from Control.
OnParentVisibleChanged(EventArgs)
Raises the VisibleChanged event when the Visible property value
of the control's container changes.(Inherited from Control.