Spread Windows Forms 13.0 Product Documentation
FarPoint.Win.Spread Assembly / FarPoint.Win.Spread Namespace / DefaultSkins Class / CopyTo Method
A one-dimensional array into which the elements from ICollection are copied
The array must have zero-based indexing.
Zero-based index in array at which to paste skins
Example


In This Topic
    CopyTo Method (DefaultSkins)
    In This Topic
    Copies skins to the specified array at the specified index.
    Syntax
    'Declaration
     
    Public Shared Sub CopyTo( _
       ByVal array As Array, _
       ByVal index As Integer _
    ) 
    'Usage
     
    Dim array As Array
    Dim index As Integer
     
    DefaultSkins.CopyTo(array, index)
    public static void CopyTo( 
       Array array,
       int index
    )

    Parameters

    array
    A one-dimensional array into which the elements from ICollection are copied
    The array must have zero-based indexing.
    index
    Zero-based index in array at which to paste skins
    Exceptions
    ExceptionDescription
    No array specified, or specified array is null (Nothing)
    Specified array is invalid; must have a rank of one
    Specified array is invalid; must have sufficient length
    Specified index is out of range; must be greater than zero
    Example
    This example creates a DefaultSkins object and populates a list control with all the choices of available skins. When the user selects a skin from the list, it is applied to the sheet in the Spread component.
    FarPoint.Win.Spread.DefaultSkins skin = new FarPoint.Win.Spread.DefaultSkins();
    Object[] myarray = new Object[FarPoint.Win.Spread.DefaultSkins.Count];
    foreach(FarPoint.Win.Spread.SheetSkin sk in FarPoint.Win.Spread.DefaultSkins.Skins)
    {
    listBox1.Items.Add(sk.Name);
    }
    FarPoint.Win.Spread.DefaultSkins.CopyTo(myarray,0);
    listBox2.Items.Add(Convert.ToString(myarray.GetValue(4)));
    
    private void listBox1_SelectedIndexChanged(object sender, System.EventArgs e)
    {
    FarPoint.Win.Spread.DefaultSkins skin = new FarPoint.Win.Spread.DefaultSkins();
    FarPoint.Win.Spread.DefaultSkins.GetAt(listBox1.SelectedIndex).Apply(fpSpread1);
    bool b;
    int i;
    foreach (FarPoint.Win.Spread.SheetSkin sk in FarPoint.Win.Spread.DefaultSkins.Skins)
    {
    b = FarPoint.Win.Spread.DefaultSkins.Contains(FarPoint.Win.Spread.DefaultSkins.Find(listBox1.SelectedItem.ToString()));
    i = FarPoint.Win.Spread.DefaultSkins.IndexOf(FarPoint.Win.Spread.DefaultSkins.GetAt(listBox1.SelectedIndex));
    textBox1.Text = b.ToString();
    textBox2.Text = i.ToString();
    }    
    Dim skin As New FarPoint.Win.Spread.DefaultSkins()
    Dim sk As FarPoint.Win.Spread.SheetSkin
    Dim myarray(skin.Count())
    For Each sk In skin.Skins
    ListBox1.Items.Add(sk.Name)
    Next
    skin.CopyTo(myarray, 0)
    ListBox2.Items.Add(Convert.ToString(myarray.GetValue(4)))
    
    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
    Dim skin As New FarPoint.Win.Spread.DefaultSkins()
    Dim sk As FarPoint.Win.Spread.SheetSkin
    skin.GetAt(ListBox1.SelectedIndex).Apply(FpSpread1)
    Dim b As Boolean
    Dim i As Integer
    For Each sk In skin.Skins
    b = skin.Contains(skin.Find(ListBox1.SelectedItem))
    i = skin.IndexOf(skin.GetAt(ListBox1.SelectedIndex))
    TextBox1.Text = b.ToString()
    TextBox2.Text = i.ToString()
    Next
    End Sub
    See Also