バージョン

SaveAsXml(String,PropertyCategories) メソッド

指定されたプロパティ カテゴリを使用して、ファイルにレイアウトを保存します。
シンタックス
'宣言
 
Public Overloads Sub SaveAsXml( _
   ByVal filename As String, _
   ByVal propertyCategories As PropertyCategories _
) 
public void SaveAsXml( 
   string filename,
   PropertyCategories propertyCategories
)

パラメータ

filename
書き込むファイルの名前。
propertyCategories
保存するプロパティ カテゴリを識別します。
解説

このメソッドを呼び出すと、レイアウトがファイルに保存されます。

保存されたレイアウトを復元するには、LoadFromXml(String,PropertyCategories) メソッドを呼び出します。

256 (PropCatGeneral) を指定すると、UltraGridLayout オブジェクトの以下のプロパティ設定が保存されます。

  • AddNewBox
  • AlphaBlendEnabled
  • BorderStyle
  • BorderStyleCaption
  • Caption
  • 有効
  • EstimatedRows
  • Font
  • InterBandSpacing
  • MaxColScrollRegions
  • MaxRowScrollRegions
  • Override
  • RowConnectorColor
  • RowConnectorStyle
  • ScrollBars
  • TabNavigation
  • TagVariant
  • ViewStyle
  • ViewStyleBand

複数の Layout カテゴリは、論理 OR を使用することで結合して保存ができます。

Clone および CopyFrom メソッドを呼び出すと、レイアウトの複製を作成できます。

使用例
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

    Private Sub UltraGrid1_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles UltraGrid1.InitializeLayout
        ' Setup the layout.
        e.Layout.Override.CellAppearance.BackColor = Color.LightYellow
        e.Layout.ViewStyleBand = ViewStyleBand.OutlookGroupBy
    End Sub

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
        ' Save the layout to a file.
        Me.UltraGrid1.DisplayLayout.SaveAsXml("c:\\test.xml")
    End Sub

    Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button2.Click
        ' Reset the layout.
        Me.UltraGrid1.DisplayLayout.Reset()
    End Sub

    Private Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button3.Click
        ' Load the saved layout.
        Me.UltraGrid1.DisplayLayout.LoadFromXml("c:\\test.xml")
    End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

		private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
		{
			// Setup the layout.
			e.Layout.Override.CellAppearance.BackColor = Color.LightYellow;
			e.Layout.ViewStyleBand = ViewStyleBand.OutlookGroupBy;
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			// Save the layout to a file.
			this.ultraGrid1.DisplayLayout.SaveAsXml( "c:\\test.xml" );
		}

		private void button2_Click(object sender, System.EventArgs e)
		{
			// Reset the layout.
			this.ultraGrid1.DisplayLayout.Reset( );
		}

		private void button3_Click(object sender, System.EventArgs e)
		{
			// Load the saved layout.
			this.ultraGrid1.DisplayLayout.LoadFromXml( "c:\\test.xml" );
		}
参照