GrapeCity MultiRow Windows Forms Documentation
TrackBarCell Class
Members  Example 


Represents a scrollable Cell that visually displays a range.
Object Model
TrackBarCell ClassGcMultiRow ClassCellStyle ClassCellNote ClassSection ClassCellStyle ClassMultiRowTouchToolBar ClassValidatorCollection ClassCellValidator Class
Syntax
<DefaultPropertyAttribute("Value")>
<DesignerAttribute(DesignerBaseTypeName="System.ComponentModel.Design.IDesigner", DesignerTypeName="GrapeCity.Win.MultiRow.Design.DataFieldCellDesigner,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")>
<ToolboxItemFilterAttribute(FilterString="GrapeCity.Win.MultiRow.Template7", FilterType=ToolboxItemFilterType.Custom Or  _
    ToolboxItemFilterType.Prevent Or  _
    ToolboxItemFilterType.Require)>
<SRDescriptionAttribute("Enables the user to select a value by dragging a small button. ")>
<ToolboxBitmapAttribute()>
Public Class TrackBarCell 
   Inherits Cell
   Implements IEditingCell 
Dim instance As TrackBarCell
[DefaultProperty("Value")]
[Designer(DesignerBaseTypeName="System.ComponentModel.Design.IDesigner", DesignerTypeName="GrapeCity.Win.MultiRow.Design.DataFieldCellDesigner,GrapeCity.Win.MultiRow.Design, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")]
[ToolboxItemFilter(FilterString="GrapeCity.Win.MultiRow.Template7", FilterType=ToolboxItemFilterType.Custom | 
    ToolboxItemFilterType.Prevent | 
    ToolboxItemFilterType.Require)]
[SRDescription("Enables the user to select a value by dragging a small button. ")]
[ToolboxBitmap()]
public class TrackBarCell : Cell, IEditingCell  
Remarks

The TrackBarCell class is a special type of Cell that is used to display a track bar control. The TrackBarCell implements the IEditingCell interface, so it can be edited without an editing control. The user can edit the cell value using the mouse thumb drag or keyboard up arrow, down arrow, left arrow, right arrow, Home, End, Page Up, and Page Down keys when the TrackBarCell is the current cell and is in edit mode.

The TrackBarCell is similar to the scroll bar control. You can configure ranges with the Cell.Value property of the TrackBarCell. Set the Minimum property to specify the lower end of the range and the Maximum property to specify the upper end of the range.

Notes to Inheritors:

When you derive from TrackBarCell and add new properties to the derived class, be sure to override the Clone method to copy the new properties during cloning operations. You should also call the base class's Clone method so that the properties of the base class are copied to the new cell.

Example
The following code example shows a vertical TrackBarCell. The Minimum is 10 and the Maximum is 20. Press the up arrow or down arrow key and the bar moves two positions. Click the track bar and it moves five positions. There are two positions between each tick mark.
using System;
using System.Windows.Forms;
using System.Drawing;

namespace GrapeCity.Win.MultiRow.SampleCode
{
    public class TrackBarCellDemo : Form
    {
        private GcMultiRow gcMultiRow1 = new GcMultiRow();
        private Label label = new Label();

        public TrackBarCellDemo()
        {
            this.Text = "TrackBarCell Demo";

            this.gcMultiRow1.Dock = DockStyle.Fill;
            this.Controls.Add(this.gcMultiRow1);
            this.Load += new EventHandler(Form1_Load);
            this.gcMultiRow1.CellEditedFormattedValueChanged += new 
EventHandler<CellEditedFormattedValueChangedEventArgs>(gcMultiRow1_CellEditedFormattedValueChanged);

            this.label.Dock = DockStyle.Bottom;
            this.label.Height = 30;
            this.label.BackColor = SystemColors.Info;
            this.label.Text = "Select a cell, drag the track bar or press the Up or Down key to move the slider";
            this.Controls.Add(label);

            this.Size = new Size(400, 600);
        }

        void gcMultiRow1_CellEditedFormattedValueChanged(object sender, 
CellEditedFormattedValueChangedEventArgs e)
        {
            if (this.gcMultiRow1.IsCurrentCellInEditMode)
            {
                label.Text = (this.gcMultiRow1.CurrentCell as IEditingCell).EditingCellFormattedValue.ToString();
            }
        }
      
        private void Form1_Load(object sender, EventArgs e)
        {
            TrackBarCell trackBarCell1 = new TrackBarCell();
            trackBarCell1.Size = new Size(80, 80);
            //When the slider is dragged to the top, the Cell.FormattedValue is 20.
            trackBarCell1.Maximum = 20;
            //When the slider is dragged to the bottom, the Cell.FormattedValue is 10.
            trackBarCell1.Minimum = 10;
            //Press the Up or Down key, 2 positions are moved.
            trackBarCell1.SmallChange = 2;
            //Click on  the track bar, 5 positions are moved.
            trackBarCell1.LargeChange = 5;
            //Between each tick mark, there are 2 positions.
            trackBarCell1.TickFrequency = 2;

            TrackBarCell trackBarCell2 = trackBarCell1.Clone() as TrackBarCell;
            //Track bar has a vertical orientation.
            trackBarCell2.Orientation = Orientation.Vertical;
            trackBarCell2.TickStyle = TickStyle.Both;

            Template template1 = Template.CreateGridTemplate(new Cell[] { trackBarCell1, trackBarCell2 });

            gcMultiRow1.Template = template1;
            gcMultiRow1.RowCount = 3;
        }
Imports System
Imports System.Windows.Forms
Imports System.Drawing
Imports GrapeCity.Win.MultiRow

Public Class TrackBarCellDemo
    Inherits Form
    Friend WithEvents gcMultiRow1 As New GcMultiRow()
    Private label As New Label()

    Public Sub New()
        Me.Text = "TrackBarCell Demo"
        Me.gcMultiRow1.Dock = DockStyle.Fill
        Me.Controls.Add(Me.gcMultiRow1)

        Me.label.Dock = DockStyle.Bottom
        Me.label.Height = 30
        Me.label.BackColor = SystemColors.Info
        Me.label.Text = "Select a cell, drag the track bar or press the Up or Down key to move the slider"
        Me.Controls.Add(label)

        Me.Size = New Size(400, 600)
    End Sub

    Private Sub gcMultiRow1_CellEditedFormattedValueChanged(ByVal sender As Object, ByVal e As 
CellEditedFormattedValueChangedEventArgs) Handles gcMultiRow1.CellEditedFormattedValueChanged
        If Me.gcMultiRow1.IsCurrentCellInEditMode Then
            label.Text = TryCast(Me.gcMultiRow1.CurrentCell, IEditingCell).EditingCellFormattedValue.ToString()
        End If
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        Dim trackBarCell1 As New TrackBarCell()
        trackBarCell1.Size = New Size(80, 80)
        'When the slider is dragged to the top, the Cell.FormattedValue is 20.
        trackBarCell1.Maximum = 20
        'When the slider is dragged to the bottom, the Cell.FormattedValue is 10.
        trackBarCell1.Minimum = 10
        'Press the Up or Down key, 2 positions are moved.
        trackBarCell1.SmallChange = 2
        'Click on  the track bar, 5 positions are moved.
        trackBarCell1.LargeChange = 5
        'Between each tick mark, there are 2 positions.
        trackBarCell1.TickFrequency = 2

        Dim trackBarCell2 = TryCast(trackBarCell1.Clone(), TrackBarCell)

        'Track bar has a vertical orientation.
        trackBarCell2.Orientation = Orientation.Vertical
        trackBarCell2.TickStyle = TickStyle.Both

        Dim template1 As Template = Template.CreateGridTemplate(New Cell() {trackBarCell1, trackBarCell2})

        gcMultiRow1.Template = template1
        gcMultiRow1.RowCount = 3
    End Sub
Inheritance Hierarchy

System.Object
   System.MarshalByRefObject
      System.ComponentModel.Component
         GrapeCity.Win.MultiRow.Cell
            GrapeCity.Win.MultiRow.TrackBarCell

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

TrackBarCell Members
GrapeCity.Win.MultiRow Namespace
Cell Class

 

 


Copyright © GrapeCity, inc. All rights reserved.