'宣言 Public Property MergedCellAppearance As Infragistics.Win.AppearanceBase
public Infragistics.Win.AppearanceBase MergedCellAppearance {get; set;}
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 ' Set the MergedCellStyle property to enable the merged cell functionality. ' MergedCellStyle also specifies which columns will merge their cells. ' OnlyWhenSorted specifies that only sort columns will merge their cells. e.Layout.Override.MergedCellStyle = MergedCellStyle.OnlyWhenSorted ' MergedCellContentArea specifies whether to render the contents of merged ' cells in their visible area. Setting the property to VirtualRect will ' render the contents in the full area of the merged cell even if the merged ' cell is partially scrolled out of view. e.Layout.Override.MergedCellContentArea = MergedCellContentArea.VisibleRect ' Set the appearance of merged cells. e.Layout.Override.MergedCellAppearance.BackColor = Color.LightYellow e.Layout.Override.MergedCellAppearance.ForeColor = Color.Blue ' You can override these settings on a specific band by using the override ' object of that band. e.Layout.Bands(1).Override.MergedCellStyle = MergedCellStyle.Never ' You can also override them on a specific column as well. e.Layout.Bands(0).Columns(0).MergedCellStyle = MergedCellStyle.Always e.Layout.Bands(0).Columns(0).MergedCellContentArea = MergedCellContentArea.VirtualRect e.Layout.Bands(0).Columns(0).MergedCellAppearance.BackColor = Color.Aqua ' By default the cells are merged based on the underlying cell values. ' Sometimes depending on the type of column and various other format settings ' you may want to merge cells based on the display text. You can use ' MergedCellEvaluationType property to specify whether to merge cells based ' on the value or the display text. e.Layout.Bands(0).Columns(0).MergedCellEvaluationType = MergedCellEvaluationType.MergeSameText 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) { // Set the MergedCellStyle property to enable the merged cell functionality. // MergedCellStyle also specifies which columns will merge their cells. // OnlyWhenSorted specifies that only sort columns will merge their cells. e.Layout.Override.MergedCellStyle = MergedCellStyle.OnlyWhenSorted; // MergedCellContentArea specifies whether to render the contents of merged // cells in their visible area. Setting the property to VirtualRect will // render the contents in the full area of the merged cell even if the merged // cell is partially scrolled out of view. e.Layout.Override.MergedCellContentArea = MergedCellContentArea.VisibleRect; // Set the appearance of merged cells. e.Layout.Override.MergedCellAppearance.BackColor = Color.LightYellow; e.Layout.Override.MergedCellAppearance.ForeColor = Color.Blue; // You can override these settings on a specific band by using the override // object of that band. e.Layout.Bands[1].Override.MergedCellStyle = MergedCellStyle.Never; // You can also override them on a specific column as well. e.Layout.Bands[0].Columns[0].MergedCellStyle = MergedCellStyle.Always; e.Layout.Bands[0].Columns[0].MergedCellContentArea = MergedCellContentArea.VirtualRect; e.Layout.Bands[0].Columns[0].MergedCellAppearance.BackColor = Color.Aqua; // By default the cells are merged based on the underlying cell values. // Sometimes depending on the type of column and various other format settings // you may want to merge cells based on the display text. You can use // MergedCellEvaluationType property to specify whether to merge cells based // on the value or the display text. e.Layout.Bands[0].Columns[0].MergedCellEvaluationType = MergedCellEvaluationType.MergeSameText; }