Dundas Chart for Windows Forms
CellSpan Property
See Also  Example Send comments on this topic.
DundasWinChart Assembly > Dundas.Charting.WinControl Namespace > LegendCell Class : CellSpan Property


Gets or sets the number of horizontal cells used to draw the legend cell's content.
Indicates the number of horizontal cells used to draw the content.

Syntax

Visual Basic (Declaration)  
Public Overridable Property CellSpan As Integer
Visual Basic (Usage) Copy Code
Dim instance As LegendCell
Dim value As Integer
 
instance.CellSpan = value
 
value = instance.CellSpan
C#  
public virtual int CellSpan {get; set;}

Return Value

The number of horizontal cells used to draw the legend cell content.  By default, this value is 1.

Example

In this example we ad two legend cells to a legend item, and then add the legend item to a legend.
Visual Basic Copy Code
' Create new custom legend item.
Dim legendItem As New LegendItem

' Add two cells.
legendItem.Cells.Add(New LegendCell(LegendCellType.Text, "United States", ContentAlignment.MiddleLeft))
legendItem.Cells.Add(New LegendCell(LegendCellType.SeriesSymbol, "", ContentAlignment.MiddleLeft))

' Set the first cell to span two cells.
legendItem.Cells(0).CellSpan = 2

' Add this custom legend item to the chart.
chart1.Legends("Default").CustomItems.Add(legendItem)
C# Copy Code
// Create new custom legend item.
LegendItem legendItem = new LegendItem();

// Add two cells.
legendItem.Cells.Add(new LegendCell(LegendCellType.Text, "United States", ContentAlignment.MiddleLeft));
legendItem.Cells.Add(
new LegendCell(LegendCellType.SeriesSymbol, "", ContentAlignment.MiddleLeft));

// Set the first cell to span two cells.
legendItem.Cells[0].CellSpan = 2;

// Add this custom legend item to the chart.
chart1.Legends["Default"].CustomItems.Add(legendItem);

Remarks

If the contents of a cell need to extend beyond the cell width, you can set a CellSpan to any number of cells that should be used to fit the contents. This property is most often used if you wish to add an extended header or title to the legend.

When this property is set to a value larger than 1, empty legend cells must be added in order for the contents of the extended legend cell.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2009 All Rights Reserved.