public static void AddTodayButton(UltraCalendarCombo calendar) { DateButton db = new DateButton(); db.Action = DateButtonAction.SelectDay; db.Caption = "今天"; db.Type = DateButtonType.Today; calendar.DateButtons.Add(db); }
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { UltraGridLayout gridLayout = e.Layout; switch (this.contentType) { case Enums.ContentType.Customers: #region Customers // use fixed headers. gridLayout.UseFixedHeaders = true; // turn off the fixed header indicator so the user cannot change them. gridLayout.Override.FixedHeaderIndicator = FixedHeaderIndicator.None; // turn off the border that draws between fixed cells and non-fixed cells. gridLayout.Override.FixedCellSeparatorColor = Color.Transparent; // hide the customer id column. gridLayout.Bands[0].Columns["CustomerID"].Hidden = true; // add an unbound column for an image. if (!gridLayout.Bands[0].Columns.Contains("CustomerImage")) { UltraGridColumn col = gridLayout.Bands[0].Columns.Insert(0, "CustomerImage"); col.DataType = typeof(Image); col.Style = ColumnStyle.Image; col.Header.Caption = string.Empty; col.Header.Fixed = true; } #endregion // Customers break; case Enums.ContentType.Orders: #region Orders // hide the order id column. gridLayout.Bands[0].Columns["OrderID"].Hidden = true; // set the caption of the other id fields to a ui friendly string. gridLayout.Bands[0].Columns["CustomerID"].Header.Caption = Utilities.GetLocalizedString("Customer"); gridLayout.Bands[0].Columns["EmployeeID"].Header.Caption = Utilities.GetLocalizedString("Employee"); // An example to show a combo editor in a cell instead of showing the id. Infragistics.Win.UltraWinEditors.UltraComboEditor ultraComboEditor = new UltraComboEditor(); this.Controls.Add(ultraComboEditor); ultraComboEditor.DataSource = this.nWind1.Tables["Employees"]; ultraComboEditor.DisplayMember = "LastName"; ultraComboEditor.ValueMember = "EmployeeID"; ultraComboEditor.ValueList.ItemHeight = 35; gridLayout.Bands[0].Columns["EmployeeID"].Style = ColumnStyle.DropDownList; gridLayout.Bands[0].Columns["EmployeeID"].EditorComponent = ultraComboEditor; // An example to show a combo editor in a cell instead of showing the id. Infragistics.Win.UltraWinEditors.UltraComboEditor ultraComboEditor2 = new UltraComboEditor(); this.Controls.Add(ultraComboEditor2); ultraComboEditor2.DataSource = this.nWind1.Tables["Customers"]; ultraComboEditor2.DisplayMember = "CompanyName"; ultraComboEditor2.ValueMember = "CustomerID"; ultraComboEditor2.ValueList.ItemHeight = 35; gridLayout.Bands[0].Columns["CustomerID"].Style = ColumnStyle.DropDownList; gridLayout.Bands[0].Columns["CustomerID"].EditorComponent = ultraComboEditor2; // An example to show a combo editor in a cell instead of showing the id. Infragistics.Win.UltraWinEditors.UltraComboEditor ultraComboEditor3 = new UltraComboEditor(); this.Controls.Add(ultraComboEditor3); ultraComboEditor3.DataSource = this.nWind1.Tables["Shippers"]; ultraComboEditor3.DisplayMember = "CompanyName"; ultraComboEditor3.ValueMember = "ShipperID"; ultraComboEditor3.ValueList.ItemHeight = 35; gridLayout.Bands[0].Columns["ShipVia"].Style = ColumnStyle.DropDownList; gridLayout.Bands[0].Columns["ShipVia"].EditorComponent = ultraComboEditor3; // An example to show a calendar combo in a cell instead of showing the DateTimeEditor and the .net month calendar. Infragistics.Win.UltraWinSchedule.UltraCalendarCombo ultraCalendarCombo = new UltraCalendarCombo(); this.Controls.Add(ultraCalendarCombo); gridLayout.Bands[0].Columns["OrderDate"].EditorComponent = ultraCalendarCombo; Infragistics.Win.UltraWinSchedule.UltraCalendarCombo ultraCalendarCombo2 = new UltraCalendarCombo(); this.Controls.Add(ultraCalendarCombo2); gridLayout.Bands[0].Columns["RequiredDate"].EditorComponent = ultraCalendarCombo2; Infragistics.Win.UltraWinSchedule.UltraCalendarCombo ultraCalendarCombo3 = new UltraCalendarCombo(); this.Controls.Add(ultraCalendarCombo3); gridLayout.Bands[0].Columns["ShippedDate"].EditorComponent = ultraCalendarCombo3; #endregion // Orders break; case Enums.ContentType.OrderDetails: #region OrderDetails // set the caption of the other id fields to a ui friendly string. gridLayout.Bands[0].Columns["OrderID"].Header.Caption = Utilities.GetLocalizedString("Order"); gridLayout.Bands[0].Columns["ProductID"].Header.Caption = Utilities.GetLocalizedString("Product"); // give ProductID a MinWidth so it looks nice. gridLayout.Bands[0].Columns["ProductID"].MinWidth = 200; // An example to show a combo editor in a cell instead of showing the id. Infragistics.Win.UltraWinEditors.UltraComboEditor ultraComboEditor4 = new UltraComboEditor(); this.Controls.Add(ultraComboEditor4); ultraComboEditor4.DataSource = this.nWind1.Tables["Products"]; ultraComboEditor4.DisplayMember = "ProductName"; ultraComboEditor4.ValueMember = "ProductID"; gridLayout.Bands[0].Columns["ProductID"].Style = ColumnStyle.DropDownList; gridLayout.Bands[0].Columns["ProductID"].EditorComponent = ultraComboEditor4; // UnitPrice can pick up local currency symbols and display styles. gridLayout.Bands[0].Columns["UnitPrice"].Style = ColumnStyle.Currency; gridLayout.Bands[0].Columns["UnitPrice"].MaskDisplayMode = MaskMode.IncludeLiterals; // make this grid show in OutlookGroupBy mode. gridLayout.ViewStyleBand = ViewStyleBand.OutlookGroupBy; // make the OrderID column the GroupBy column. gridLayout.Bands[0].SortedColumns.Add("OrderID", false, true); #endregion // OrderDetails break; case Enums.ContentType.QuarterlyOrders: break; case Enums.ContentType.ProductSales: #region Products // hide the product id and supplier id columns. gridLayout.Bands[0].Columns["ProductID"].Hidden = true; gridLayout.Bands[0].Columns["SupplierID"].Hidden = true; // set the caption of the other id fields to a ui friendly string. gridLayout.Bands[0].Columns["CategoryID"].Header.Caption = Utilities.GetLocalizedString("Category"); // An example to show a combo editor in a cell instead of showing the id. Infragistics.Win.UltraWinEditors.UltraComboEditor ultraComboEditor5 = new UltraComboEditor(); this.Controls.Add(ultraComboEditor5); ultraComboEditor5.DataSource = this.nWind1.Tables["Categories"]; ultraComboEditor5.DisplayMember = "CategoryName"; ultraComboEditor5.ValueMember = "CategoryID"; gridLayout.Bands[0].Columns["CategoryID"].Style = ColumnStyle.DropDownList; gridLayout.Bands[0].Columns["CategoryID"].EditorComponent = ultraComboEditor5; // UnitPrice can pick up local currency symbols and display styles. gridLayout.Bands[0].Columns["UnitPrice"].Style = ColumnStyle.Currency; gridLayout.Bands[0].Columns["UnitPrice"].MaskDisplayMode = MaskMode.IncludeLiterals; #endregion // Products break; case Enums.ContentType.SalesByCategory: #region Categories // hide the category id and the hideous NorthWind picture columns. gridLayout.Bands[0].Columns["CategoryID"].Hidden = true; gridLayout.Bands[0].Columns["Picture"].Hidden = true; #endregion // Categories break; case Enums.ContentType.SalesByQuarter: break; case Enums.ContentType.SalesByYear: break; case Enums.ContentType.Shippers: #region Shippers // hide the shipper id column gridLayout.Bands[0].Columns["ShipperID"].Hidden = true; #endregion // Shippers break; case Enums.ContentType.Suppliers: break; default: break; } #region UI friendly column headers // give the column headers more readable strings instead of mushed camel casing text. foreach (UltraGridBand ultraGridBand in gridLayout.Bands) { foreach (UltraGridColumn column in ultraGridBand.Columns) { Utilities.SetUIFriendlyString(column.Header); } } #endregion //UI friendly column headers }