using System;using System.Drawing;using System.Collections;using System.ComponentModel;using System.Windows.Forms;using TestInfragistics.DAL;using Infragistics.Win;using Infragistics.Win.UltraWinGrid;namespace TestInfragistics.UIL...{ /**//// <summary> /// BandAppearance 的摘要说明。 /// </summary> public class BandAppearance : System.Windows.Forms.Form ...{ private Infragistics.Win.UltraWinGrid.UltraGrid ultraGrid1; internal System.Windows.Forms.Button SetColorOfBandHeaders; internal System.Windows.Forms.Button RemoveExpansionIndicators; internal System.Windows.Forms.Button MakeBandHeadersVisible; internal System.Windows.Forms.Button AllowColSizingFree; /**//// <summary> /// 必需的设计器变量。 /// </summary> private System.ComponentModel.Container components = null; public BandAppearance() ...{ // // Windows 窗体设计器支持所必需的 // InitializeComponent(); // // TODO: 在 InitializeComponent 调用后添加任何构造函数代码 // } /**//// <summary> /// 清理所有正在使用的资源。 /// </summary> protected override void Dispose( bool disposing ) ...{ if( disposing ) ...{ if(components != null) ...{ components.Dispose(); } } base.Dispose( disposing ); } Windows 窗体设计器生成的代码#region Windows 窗体设计器生成的代码 /**//// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() ...{ this.ultraGrid1 = new Infragistics.Win.UltraWinGrid.UltraGrid(); this.SetColorOfBandHeaders = new System.Windows.Forms.Button(); this.RemoveExpansionIndicators = new System.Windows.Forms.Button(); this.MakeBandHeadersVisible = new System.Windows.Forms.Button(); this.AllowColSizingFree = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.ultraGrid1)).BeginInit(); this.SuspendLayout(); // // ultraGrid1 // this.ultraGrid1.Cursor = System.Windows.Forms.Cursors.Default; this.ultraGrid1.Dock = System.Windows.Forms.DockStyle.Bottom; this.ultraGrid1.Location = new System.Drawing.Point(0, 110); this.ultraGrid1.Name = "ultraGrid1"; this.ultraGrid1.Size = new System.Drawing.Size(488, 376); this.ultraGrid1.TabIndex = 0; this.ultraGrid1.Text = "ultraGrid1"; this.ultraGrid1.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(this.ultraGrid1_InitializeRow); // // SetColorOfBandHeaders // this.SetColorOfBandHeaders.Location = new System.Drawing.Point(249, 8); this.SetColorOfBandHeaders.Name = "SetColorOfBandHeaders"; this.SetColorOfBandHeaders.Size = new System.Drawing.Size(230, 24); this.SetColorOfBandHeaders.TabIndex = 8; this.SetColorOfBandHeaders.Text = "Set Color of Band Headers"; this.SetColorOfBandHeaders.Click += new System.EventHandler(this.SetColorOfBandHeaders_Click); // // RemoveExpansionIndicators // this.RemoveExpansionIndicators.Location = new System.Drawing.Point(9, 80); this.RemoveExpansionIndicators.Name = "RemoveExpansionIndicators"; this.RemoveExpansionIndicators.Size = new System.Drawing.Size(327, 32); this.RemoveExpansionIndicators.TabIndex = 7; this.RemoveExpansionIndicators.Text = "移除树型指示器Remove Expansion Indicators"; this.RemoveExpansionIndicators.Click += new System.EventHandler(this.RemoveExpansionIndicators_Click); // // MakeBandHeadersVisible // this.MakeBandHeadersVisible.Location = new System.Drawing.Point(9, 8); this.MakeBandHeadersVisible.Name = "MakeBandHeadersVisible"; this.MakeBandHeadersVisible.Size = new System.Drawing.Size(230, 24); this.MakeBandHeadersVisible.TabIndex = 6; this.MakeBandHeadersVisible.Text = "Make Band Headers Visible"; this.MakeBandHeadersVisible.Click += new System.EventHandler(this.MakeBandHeadersVisible_Click); // // AllowColSizingFree // this.AllowColSizingFree.Location = new System.Drawing.Point(9, 40); this.AllowColSizingFree.Name = "AllowColSizingFree"; this.AllowColSizingFree.Size = new System.Drawing.Size(230, 25); this.AllowColSizingFree.TabIndex = 5; this.AllowColSizingFree.Text = "Allow Column Sizing Free"; this.AllowColSizingFree.Click += new System.EventHandler(this.AllowColSizingFree_Click); // // BandAppearance // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.ClientSize = new System.Drawing.Size(488, 486); this.Controls.Add(this.SetColorOfBandHeaders); this.Controls.Add(this.RemoveExpansionIndicators); this.Controls.Add(this.MakeBandHeadersVisible); this.Controls.Add(this.AllowColSizingFree); this.Controls.Add(this.ultraGrid1); this.Name = "BandAppearance"; this.Text = "BandAppearance"; this.Load += new System.EventHandler(this.BandAppearance_Load); ((System.ComponentModel.ISupportInitialize)(this.ultraGrid1)).EndInit(); this.ResumeLayout(false); } #endregion private void BandAppearance_Load(object sender, System.EventArgs e) ...{ CustOrderDataSet cust = new CustOrderDataSet(); ultraGrid1.DataSource = cust.MakeCustOrderDataSet(); } private void ultraGrid1_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e) ...{ if(e.Row.Band.Index ==0 ) ...{ e.Row.Expanded =true; } } private void AllowColSizingFree_Click(object sender, System.EventArgs e) ...{ ultraGrid1.DisplayLayout.Override.AllowColSizing = AllowColSizing.Free; } private void MakeBandHeadersVisible_Click(object sender, System.EventArgs e) ...{ ultraGrid1.DisplayLayout.Bands[0].HeaderVisible = true; ultraGrid1.DisplayLayout.Bands[1].HeaderVisible = true; ultraGrid1.DisplayLayout.Bands[1].Header.Caption ="dddddddddddddddddd"; } private void SetColorOfBandHeaders_Click(object sender, System.EventArgs e) ...{ AppearanceBase app = ultraGrid1.DisplayLayout.Bands[0].Header.Appearance; app.ThemedElementAlpha = Alpha.Transparent; app.BackColor = SystemColors.ActiveCaption; app.ForeColor = SystemColors.ActiveCaptionText; app = ultraGrid1.DisplayLayout.Bands[1].Header.Appearance; app.ThemedElementAlpha = Alpha.Transparent; app.BackColor = Color.Blue; app.BackColor2 = Color.Red; app.ForeColor = Color.White; app.BackGradientStyle = GradientStyle.Horizontal; } private void RemoveExpansionIndicators_Click(object sender, System.EventArgs e) ...{ ultraGrid1.DisplayLayout.Bands[0].Indentation =0; ultraGrid1.DisplayLayout.Bands[1].Indentation =0; ultraGrid1.DisplayLayout.RowConnectorStyle = RowConnectorStyle.None; } }}