GrapeCity MultiRow Windows Forms Documentation
Load(Stream) Method
Example 


The source XML file stream.
Deserializes the current NamedCellStyleDictionary from an XML file stream.
Syntax
Public Overloads Sub Load( _
   ByVal stream As Stream _
) 
Dim instance As NamedCellStyleDictionary
Dim stream As Stream
 
instance.Load(stream)
public void Load( 
   Stream stream
)

Parameters

stream
The source XML file stream.
Exceptions
ExceptionDescription
System.ArgumentNullExceptionThe stream is a null reference (Nothing in Visual Basic).
Remarks
You can make a set of skins, store them in the NamedCellStyleDictionary, and then save them to a file. You can then load them from a file later if needed.
Example
The following code example shows how to implement the "AlternatingColumnsDefaultCellStyle" and "ColumnsDefaultCellStyle". When the form is loaded, add a Template to the GcMultiRow control. This Template sets the odd columns with "ColumnsDefaultCellStyle" and sets the even columns with "AlternatingColumnsDefaultCellStyle". After the application is running, if you want to change the "AlternatingColumnsDefaultCellStyle" or "ColumnsDefaultCellStyle", you need only change the GcMultiRow.NamedCellStyles's corresponding item and the new CellStyle is applied. You can save GcMultiRow.NamedCellStyles to a file and then load the file later if needed. This code example is part of a larger example provided for the NamedCellStyle class.
void setFirstNamedCellStyle_Click(object sender, EventArgs e)
       {
           CellStyle alternatingColumnsDefaultCellStyle = new CellStyle();
           alternatingColumnsDefaultCellStyle.BackColor = Color.FromArgb(150, 160, 159);
           alternatingColumnsDefaultCellStyle.ForeColor = Color.White;
           alternatingColumnsDefaultCellStyle.NullValue = "Text";
           //Change the "AlternatingColumnsDefaultCellStyle"
           this.gcMultiRow1.NamedCellStyles["AlternatingColumnsDefaultCellStyle"] = alternatingColumnsDefaultCellStyle;

           CellStyle columnsDefaultCellStyle = new CellStyle();
           columnsDefaultCellStyle.BackColor = Color.FromArgb(226, 228, 228);
           columnsDefaultCellStyle.ForeColor = Color.Black;
           columnsDefaultCellStyle.NullValue = "Text";
           //Change the "ColumnsDefaultCellStyle"
           this.gcMultiRow1.NamedCellStyles["ColumnsDefaultCellStyle"] = columnsDefaultCellStyle;

           //You can load one predefined NamedCellStyleDictionary from one file.
           //this.gcMultiRow1.NamedCellStyles.Load(@"C:\temp\NamedCellStyles.xml");
           //You can save the NamedCellStyleDictionary to one file.
           //this.gcMultiRow1.NamedCellStyles.Save(@"C:\temp\NamedCellStyles.xml");
       }
Private Sub setFirstNamedCellStyle_Click(ByVal sender As Object, ByVal e As EventArgs) Handles setFirstStyle.Click
        Dim alternatingColumnsDefaultCellStyle As New CellStyle()
        alternatingColumnsDefaultCellStyle.BackColor = Color.FromArgb(150, 160, 159)
        alternatingColumnsDefaultCellStyle.ForeColor = Color.White
        alternatingColumnsDefaultCellStyle.NullValue = "Text"
        'Change the "AlternatingColumnsDefaultCellStyle"
        Me.gcMultiRow1.NamedCellStyles("AlternatingColumnsDefaultCellStyle") = alternatingColumnsDefaultCellStyle

        Dim columnsDefaultCellStyle As New CellStyle()
        columnsDefaultCellStyle.BackColor = Color.FromArgb(226, 228, 228)
        columnsDefaultCellStyle.ForeColor = Color.Black
        columnsDefaultCellStyle.NullValue = "Text"
        'Change the "ColumnsDefaultCellStyle"
        Me.gcMultiRow1.NamedCellStyles("ColumnsDefaultCellStyle") = columnsDefaultCellStyle

        'You can load one predefined NamedCellStyleDictionary from one file.
        'this.gcMultiRow1.NamedCellStyles.Load(@"C:\temp\NamedCellStyles.xml");
        'You can save the NamedCellStyleDictionary to one file.
        'this.gcMultiRow1.NamedCellStyles.Save(@"C:\temp\NamedCellStyles.xml");
    End Sub
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

NamedCellStyleDictionary Class
NamedCellStyleDictionary Members
Overload List
Load(string)
Save(Stream)

 

 


Copyright © GrapeCity, inc. All rights reserved.