SlideShare a Scribd company logo
Topic Name:
TrackBar & TreeView
MUAHAMMAD WASEEM ASIM
ROLL NO. 939
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.
TrackBar
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.
First Property “Size”
First Property “Size”
Second Property “BackColor”
Third Property “Visible”
Fourth Property “Value”
Common Properties
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.
TrackBar and TreeView
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.
TrackBar and TreeView
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
 {
Object Creation…Continue
 public partial class Form1 : Form
 {
 public Form1()
 {
 InitializeComponent();
 }
 private void trackBar1_Scroll(object sender, EventArgs e)
 {
 label1.Text = trackBar1.Value.ToString();
 }
 private void label1_Click(object sender, EventArgs e)
 {
 }
Object Creation…Continue
 private void Form1_Load(object sender, EventArgs e)
 {
 label1.Text = "0";
 trackBar1.Maximum = 0;
 trackBar1.Maximum = 200;
 trackBar1.TickFrequency = 5;
 }
 }
 }
Object Creation…Continue.. Show
Object Creation
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
 {
Object Creation…Continue
 public Form1()
 {
 InitializeComponent();
 }
 private void Form1_Load(object sender, EventArgs e)
 {
 trackBar1.Minimum = 0;
 trackBar1.Maximum = 400;
 pictureBox1.Left = (ClientSize.Width - pictureBox1.Width) / 2;
 pictureBox1.Top = (ClientSize.Height - pictureBox1.Height) / 2;
 }
 private void pictureBox1_Click(object sender, EventArgs e)
 {
 }
Object Creation…Continue
 private void trackBar1_Scroll(object sender, EventArgs e)
 {
 pictureBox1.Size = new Size(trackBar1.Value,
pictureBox1.Size.Height);
 pictureBox1.Left = (ClientSize.Width - pictureBox1.Width) / 2;
 pictureBox1.Top = (ClientSize.Height - pictureBox1.Height) / 2;
 }
 }
 }
Object Creation…Continue.. Show
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;
Use
TreeView
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.
TreeView
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.
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.
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.
TrackBar and TreeView
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.
TrackBar and TreeView
Constructors
 TreeView() Initializes a new instance of the TreeView class.
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
 {
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)
 {
Object Creation…Continue
 treeView1.Nodes[0].Nodes.Add("Windows");
 treeView1.Nodes[0].Nodes[0].Nodes.Add("Windows 7");
 treeView1.Nodes[0].Nodes[0].Nodes.Add("Windows 8");
 treeView1.Nodes[0].Nodes[0].Nodes[1].Nodes.Add("Windows 8.1");
 treeView1.Nodes[0].Nodes.Add("Operating System");
 treeView1.Nodes[0].Nodes[1].Nodes.Add("Unix");
 treeView1.Nodes[0].Nodes[1].Nodes.Add("Linux");
 treeView1.Nodes[0].Nodes.Add("Database");
 treeView1.Nodes[0].Nodes[2].Nodes.Add("ORACLE");
 treeView1.Nodes[0].Nodes[2].Nodes.Add("SQL SERVER");
Object Creation…Continue
 treeView1.Nodes[0].Nodes.Add(".net language");
 treeView1.Nodes[0].Nodes[3].Nodes.Add("C#");
 treeView1.Nodes[0].Nodes[3].Nodes.Add("vb.net");
 }
 }
 }
TrackBar and TreeView
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.

More Related Content

PPTX
Tree View X software ppt.pptx
PDF
Introduction to Perl and BioPerl
PDF
BITS: UCSC genome browser - Part 1
PDF
UniProt and the Semantic Web
PPTX
Protein Data Bank
PPTX
Introduction to distributed database
PPTX
Lesson 2 network database system
PDF
Overlap Layout Consensus assembly
Tree View X software ppt.pptx
Introduction to Perl and BioPerl
BITS: UCSC genome browser - Part 1
UniProt and the Semantic Web
Protein Data Bank
Introduction to distributed database
Lesson 2 network database system
Overlap Layout Consensus assembly

What's hot (20)

PPT
Protein Structure, Databases and Structural Alignment
PPTX
Database management system
PPTX
RNA-seq differential expression analysis
PPTX
Presentation on Biological database By Elufer Akram @ University Of Science ...
PDF
Gene Expression Data Analysis
PPT
Biopython
PPTX
The Relational Model
DOCX
Protein sequence databases
PPT
Sequence Alignment In Bioinformatics
PPTX
The Relational Database Model
PPTX
Sequence Analysis
PPTX
PPTX
Introduction to databases.pptx
PDF
FORMS OF DNA
PDF
PDF
PDF
Introduction to Data Mining / Bioinformatics
PDF
BITS: Overview of important biological databases beyond sequences
PPTX
Comparative genomics
Protein Structure, Databases and Structural Alignment
Database management system
RNA-seq differential expression analysis
Presentation on Biological database By Elufer Akram @ University Of Science ...
Gene Expression Data Analysis
Biopython
The Relational Model
Protein sequence databases
Sequence Alignment In Bioinformatics
The Relational Database Model
Sequence Analysis
Introduction to databases.pptx
FORMS OF DNA
Introduction to Data Mining / Bioinformatics
BITS: Overview of important biological databases beyond sequences
Comparative genomics
Ad

Similar to TrackBar and TreeView (20)

PPT
Chap2.pptgsosnsvsjsnc sounds ksngdid idvdmg dhdo an the that was how
PPTX
Windows form application_in_vb(vb.net --3 year)
PDF
PPTX
Windows form application - C# Training
PPTX
Chapter1 of programming object orienteds
PPT
Visual programming basic.ppt bs cs5th class
PPT
Visual Studio Toolbox Unleashed
PPTX
LECTURE 12 WINDOWS FORMS PART 2.pptx
PPT
Csphtp1 02
PPT
Visual Studio 2012 Course Blackboard TIC
PDF
Interactive material
PPS
02 gui 02
PDF
Test Bank for Starting Out With Visual Basic 2012, 6th Edition Gaddis, Irvine
PPT
Session 3 Bai 3 ve winform
PDF
Visual Basic IDE Introduction
PDF
Visual Basic IDE Intro.pdf
PDF
Test Bank for Starting Out With Visual Basic 2012, 6th Edition Gaddis, Irvine
PDF
Ch7.2-Controls for Programm 001-193819qk
PPTX
unit3.2 (1).pptx
PPT
Introduction to Visual Studio 2022-OS.ppt
Chap2.pptgsosnsvsjsnc sounds ksngdid idvdmg dhdo an the that was how
Windows form application_in_vb(vb.net --3 year)
Windows form application - C# Training
Chapter1 of programming object orienteds
Visual programming basic.ppt bs cs5th class
Visual Studio Toolbox Unleashed
LECTURE 12 WINDOWS FORMS PART 2.pptx
Csphtp1 02
Visual Studio 2012 Course Blackboard TIC
Interactive material
02 gui 02
Test Bank for Starting Out With Visual Basic 2012, 6th Edition Gaddis, Irvine
Session 3 Bai 3 ve winform
Visual Basic IDE Introduction
Visual Basic IDE Intro.pdf
Test Bank for Starting Out With Visual Basic 2012, 6th Edition Gaddis, Irvine
Ch7.2-Controls for Programm 001-193819qk
unit3.2 (1).pptx
Introduction to Visual Studio 2022-OS.ppt
Ad

Recently uploaded (20)

PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PDF
Digital Systems & Binary Numbers (comprehensive )
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Nekopoi APK 2025 free lastest update
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
history of c programming in notes for students .pptx
PPTX
Transform Your Business with a Software ERP System
PDF
top salesforce developer skills in 2025.pdf
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
System and Network Administraation Chapter 3
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
Digital Systems & Binary Numbers (comprehensive )
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Reimagine Home Health with the Power of Agentic AI​
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Navsoft: AI-Powered Business Solutions & Custom Software Development
Nekopoi APK 2025 free lastest update
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
wealthsignaloriginal-com-DS-text-... (1).pdf
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Which alternative to Crystal Reports is best for small or large businesses.pdf
Understanding Forklifts - TECH EHS Solution
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
history of c programming in notes for students .pptx
Transform Your Business with a Software ERP System
top salesforce developer skills in 2025.pdf
Upgrade and Innovation Strategies for SAP ERP Customers
System and Network Administraation Chapter 3

TrackBar and TreeView

  • 1. Topic Name: TrackBar & TreeView MUAHAMMAD WASEEM ASIM ROLL NO. 939
  • 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.
  • 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.
  • 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  {
  • 16. Object Creation…Continue  public partial class Form1 : Form  {  public Form1()  {  InitializeComponent();  }  private void trackBar1_Scroll(object sender, EventArgs e)  {  label1.Text = trackBar1.Value.ToString();  }  private void label1_Click(object sender, EventArgs e)  {  }
  • 17. Object Creation…Continue  private void Form1_Load(object sender, EventArgs e)  {  label1.Text = "0";  trackBar1.Maximum = 0;  trackBar1.Maximum = 200;  trackBar1.TickFrequency = 5;  }  }  }
  • 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  {
  • 21. Object Creation…Continue  public Form1()  {  InitializeComponent();  }  private void Form1_Load(object sender, EventArgs e)  {  trackBar1.Minimum = 0;  trackBar1.Maximum = 400;  pictureBox1.Left = (ClientSize.Width - pictureBox1.Width) / 2;  pictureBox1.Top = (ClientSize.Height - pictureBox1.Height) / 2;  }  private void pictureBox1_Click(object sender, EventArgs e)  {  }
  • 22. Object Creation…Continue  private void trackBar1_Scroll(object sender, EventArgs e)  {  pictureBox1.Size = new Size(trackBar1.Value, pictureBox1.Size.Height);  pictureBox1.Left = (ClientSize.Width - pictureBox1.Width) / 2;  pictureBox1.Top = (ClientSize.Height - pictureBox1.Height) / 2;  }  }  }
  • 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;
  • 25. Use
  • 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.
  • 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.
  • 35. Constructors  TreeView() Initializes a new instance of the TreeView class.
  • 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)  {
  • 38. Object Creation…Continue  treeView1.Nodes[0].Nodes.Add("Windows");  treeView1.Nodes[0].Nodes[0].Nodes.Add("Windows 7");  treeView1.Nodes[0].Nodes[0].Nodes.Add("Windows 8");  treeView1.Nodes[0].Nodes[0].Nodes[1].Nodes.Add("Windows 8.1");  treeView1.Nodes[0].Nodes.Add("Operating System");  treeView1.Nodes[0].Nodes[1].Nodes.Add("Unix");  treeView1.Nodes[0].Nodes[1].Nodes.Add("Linux");  treeView1.Nodes[0].Nodes.Add("Database");  treeView1.Nodes[0].Nodes[2].Nodes.Add("ORACLE");  treeView1.Nodes[0].Nodes[2].Nodes.Add("SQL SERVER");
  • 39. Object Creation…Continue  treeView1.Nodes[0].Nodes.Add(".net language");  treeView1.Nodes[0].Nodes[3].Nodes.Add("C#");  treeView1.Nodes[0].Nodes[3].Nodes.Add("vb.net");  }  }  }
  • 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.