バージョン

UltraGridOverride クラス

UltraGridOverride クラスを使用すると、グリッドの複数のレベルでプロパティを設定できます。
シンタックス
'宣言
 
Public Class UltraGridOverride 
   Inherits Infragistics.Shared.KeyedSubObjectBase
   Implements Infragistics.Shared.IKeyedSubObject, Infragistics.Shared.IKeyedSubObjectEx, Infragistics.Win.ISupportPresets 
public class UltraGridOverride : Infragistics.Shared.KeyedSubObjectBase, Infragistics.Shared.IKeyedSubObject, Infragistics.Shared.IKeyedSubObjectEx, Infragistics.Win.ISupportPresets  
解説

Override オブジェクトは、グリッドのバンドのルックおよび動作を定義するプロパティを持ちます。

Override プロパティは、UltraGridBase.DisplayLayout および UltraGridBand オブジェクトの両方に存在します。そのため、すべてのバンドに適用するプロパティを設定してから、それらのプロパティ設定を個々のバンドでオーバーライドできます。Override の一部のプロパティは列にも存在するため、さらに細かいレベルでオーバーライドすることも可能です。例:

VB の場合:

Me.UltraGrid1.DisplayLayout.Override.CellAppearance.BackColor = Color.Blue

Me.UltraGrid1.DisplayLayout.Bands(1).Override.CellAppearance.BackColor = Color.White

Me.UltraGrid1.DisplayLayout.Bands(1).Columns(0).CellAppearance.BackColor = Color.Red

C# の場合:

this.ultraGrid1.DisplayLayout.Override.CellAppearance.BackColor = Color.Blue;

this.ultraGrid1.DisplayLayout.Bands[1].Override.CellAppearance.BackColor = Color.White;

this.ultraGrid1.DisplayLayout.Bands[1].Columns[0].CellAppearance.BackColor = Color.Red;

この場合、コードの最初の行はグリッドのすべてのセルに影響し、BackColor を Blue に設定します。2 行目は Band 1 のすべてのセルの BackColor を White に設定します。3 行目は Band 1 の Column 0 のすべてのセルの BackColor を Red に設定します。一般に、より小さいオブジェクトの方がより大きいオブジェクトより優先されます。列は最も小さい (最も限定的な) オブジェクトであるため、列のプロパティ設定はバンドの Override より優先されます。バンドは DisplayLayout よりは小さい (限定的) です。したがって、バンドの Override の設定は、DisplayLayout の Override の設定より優先されます。

使用例
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
	Dim o As Infragistics.Win.UltraWinGrid.UltraGridOverride
	' Get the Override from the layout or a specific band (in this case band 2)
	If CheckBox1.Checked Then
		o = Me.UltraGrid1.DisplayLayout.Override
	Else
		o = Me.UltraGrid1.DisplayLayout.Bands(2).Override
	End If

	o.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.TabRepeat
	o.AllowColMoving = Infragistics.Win.UltraWinGrid.AllowColMoving.WithinBand
	o.AllowColSizing = Infragistics.Win.UltraWinGrid.AllowColSizing.Synchronized
	o.AllowColSwapping = Infragistics.Win.UltraWinGrid.AllowColSwapping.WithinGroup
	o.AllowDelete = Infragistics.Win.DefaultableBoolean.False
	o.AllowGroupBy = Infragistics.Win.DefaultableBoolean.True
	o.AllowGroupMoving = Infragistics.Win.UltraWinGrid.AllowGroupMoving.NotAllowed
	o.AllowGroupSwapping = Infragistics.Win.UltraWinGrid.AllowGroupSwapping.NotAllowed
	o.AllowUpdate = Infragistics.Win.DefaultableBoolean.True
	o.BorderStyleCardArea = Infragistics.Win.UIElementBorderStyle.InsetSoft
	o.BorderStyleCell = Infragistics.Win.UIElementBorderStyle.Solid
	o.BorderStyleHeader = Infragistics.Win.UIElementBorderStyle.Default
	o.BorderStyleRow = Infragistics.Win.UIElementBorderStyle.Solid
	o.CardSpacing = 2
	o.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.CellSelect
	o.CellMultiLine = Infragistics.Win.DefaultableBoolean.False
	o.CellPadding = 2
	o.CellSpacing = 3
	o.DefaultColWidth = 120
	o.DefaultRowHeight = 20
	o.ExpansionIndicator = Infragistics.Win.UltraWinGrid.ShowExpansionIndicator.CheckOnExpand
	o.GroupByColumnsHidden = Infragistics.Win.DefaultableBoolean.True
	o.GroupByRowPadding = 2
	o.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti
	o.MaxSelectedCells = 1000
	o.MaxSelectedRows = 100
	o.NullText = "{null}"
	o.RowSelectors = Infragistics.Win.DefaultableBoolean.True
	o.RowSizing = Infragistics.Win.UltraWinGrid.RowSizing.Free
	o.RowSizingArea = Infragistics.Win.UltraWinGrid.RowSizingArea.EntireRow
	o.RowSizingAutoMaxLines = 3
	o.RowSpacingAfter = 4
	o.RowSpacingBefore = 5
	o.SelectTypeCell = Infragistics.Win.UltraWinGrid.SelectType.Extended
	o.SelectTypeCol = Infragistics.Win.UltraWinGrid.SelectType.ExtendedAutoDrag
	o.SelectTypeGroupByRow = Infragistics.Win.UltraWinGrid.SelectType.Single
	o.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.Extended
	o.TipStyleCell = Infragistics.Win.UltraWinGrid.TipStyle.Show
	o.TipStyleRowConnector = Infragistics.Win.UltraWinGrid.TipStyle.Hide
	o.TipStyleScroll = Infragistics.Win.UltraWinGrid.TipStyle.Default
	o.ActiveCardCaptionAppearance.BackColor = Color.AliceBlue
	o.ActiveCellAppearance.ForeColor = Color.Red
	o.ActiveRowAppearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True
	o.CardAreaAppearance.BackColor = Color.BlueViolet
	o.CardAreaAppearance.BackColor2 = Color.BlanchedAlmond
	o.CardAreaAppearance.BackGradientStyle = Infragistics.Win.GradientStyle.VerticalBump
	o.CardCaptionAppearance.FontData.SizeInPoints = 20.0
	o.CellAppearance.TextTrimming = Infragistics.Win.TextTrimming.EllipsisCharacter        
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
{
    Infragistics.Win.UltraWinGrid.UltraGridOverride o As Infragistics.Win.UltraWinGrid.UltraGridOverride
	// Get the Override from the layout or a specific band (in this case band 2)
	if (CheckBox1.Checked)
		o = Me.UltraGrid1.DisplayLayout.Override;
	else 
		o = Me.UltraGrid1.DisplayLayout.Bands(2).Override;

	o.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.TabRepeat;
	o.AllowColMoving = Infragistics.Win.UltraWinGrid.AllowColMoving.WithinBand;
	o.AllowColSizing = Infragistics.Win.UltraWinGrid.AllowColSizing.Synchronized;
	o.AllowColSwapping = Infragistics.Win.UltraWinGrid.AllowColSwapping.WithinGroup;
	o.AllowDelete = Infragistics.Win.DefaultableBoolean.False;
	o.AllowGroupBy = Infragistics.Win.DefaultableBoolean.True;
	o.AllowGroupMoving = Infragistics.Win.UltraWinGrid.AllowGroupMoving.NotAllowed;
	o.AllowGroupSwapping = Infragistics.Win.UltraWinGrid.AllowGroupSwapping.NotAllowed;
	o.AllowUpdate = Infragistics.Win.DefaultableBoolean.True;
	o.BorderStyleCardArea = Infragistics.Win.UIElementBorderStyle.InsetSoft;
	o.BorderStyleCell = Infragistics.Win.UIElementBorderStyle.Solid;
	o.BorderStyleHeader = Infragistics.Win.UIElementBorderStyle.Default;
	o.BorderStyleRow = Infragistics.Win.UIElementBorderStyle.Solid;
	o.CardSpacing = 2;
	o.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.CellSelect;
	o.CellMultiLine = Infragistics.Win.DefaultableBoolean.False;
	o.CellPadding = 2;
	o.CellSpacing = 3;
	o.DefaultColWidth = 120;
	o.DefaultRowHeight = 20;
	o.ExpansionIndicator = Infragistics.Win.UltraWinGrid.ShowExpansionIndicator.CheckOnExpand;
	o.GroupByColumnsHidden = Infragistics.Win.DefaultableBoolean.True;
	o.GroupByRowPadding = 2;
	o.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti;
	o.MaxSelectedCells = 1000;
	o.MaxSelectedRows = 100;
	o.NullText = "{null}";
	o.RowSelectors = Infragistics.Win.DefaultableBoolean.True;
	o.RowSizing = Infragistics.Win.UltraWinGrid.RowSizing.Free;
	o.RowSizingArea = Infragistics.Win.UltraWinGrid.RowSizingArea.EntireRow;
	o.RowSizingAutoMaxLines = 3;
	o.RowSpacingAfter = 4;
	o.RowSpacingBefore = 5;
	o.SelectTypeCell = Infragistics.Win.UltraWinGrid.SelectType.Extended;
	o.SelectTypeCol = Infragistics.Win.UltraWinGrid.SelectType.ExtendedAutoDrag;
	o.SelectTypeGroupByRow = Infragistics.Win.UltraWinGrid.SelectType.Single;
	o.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.Extended;
	o.TipStyleCell = Infragistics.Win.UltraWinGrid.TipStyle.Show;
	o.TipStyleRowConnector = Infragistics.Win.UltraWinGrid.TipStyle.Hide;
	o.TipStyleScroll = Infragistics.Win.UltraWinGrid.TipStyle.Default;
	o.ActiveCardCaptionAppearance.BackColor = Color.AliceBlue;
	o.ActiveCellAppearance.ForeColor = Color.Red;
	o.ActiveRowAppearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True;
	o.CardAreaAppearance.BackColor = Color.BlueViolet;
	o.CardAreaAppearance.BackColor2 = Color.BlanchedAlmond;
	o.CardAreaAppearance.BackGradientStyle = Infragistics.Win.GradientStyle.VerticalBump;
	o.CardCaptionAppearance.FontData.SizeInPoints = 20.0;
	o.CellAppearance.TextTrimming = Infragistics.Win.TextTrimming.EllipsisCharacter;
}
参照