'宣言 Public Property ButtonStyle As Infragistics.Win.UIElementButtonStyle
public Infragistics.Win.UIElementButtonStyle ButtonStyle {get; set;}
Imports Infragistics.Win Imports Infragistics.Win.UltraWinEditors Private Sub SetupAppearance() ' Create a new Appearance object Dim appearance As Infragistics.Win.Appearance = New Infragistics.Win.Appearance() ' Set some of the color properties of the Appearance object appearance.BackColor = Color.White appearance.BackColor2 = Color.LightBlue appearance.ForeColor = Color.DarkBlue ' Set the background gradient style appearance.BackGradientStyle = GradientStyle.ForwardDiagonal ' Set the AlwaysInEditMode property to false so gradient drawing ' will be enabled when the control does not have the input focus ' ' Note that this only applies to the controls that use a TextBox for ' their edit portion (UltraTextEditor, UltraComboEditor, and UltraFontNameEditor) Me.ultraTextEditor1.AlwaysInEditMode = False Me.ultraComboEditor1.AlwaysInEditMode = False Me.ultraFontNameEditor1.AlwaysInEditMode = False ' Set each UltraWinEditor control's Appearance property to the ' Appearance object we just created, so they all have the same ' appearance Me.ultraTextEditor1.Appearance = appearance Me.ultraComboEditor1.Appearance = appearance Me.ultraFontNameEditor1.Appearance = appearance Me.ultraDateTimeEditor1.Appearance = appearance Me.ultraNumericEditor1.Appearance = appearance Me.ultraCurrencyEditor1.Appearance = appearance ' Create another Appearance object that we will assign to the ' ButtonAppearance property of the relevant controls Dim buttonAppearance As Infragistics.Win.Appearance = New Infragistics.Win.Appearance() buttonAppearance.BackColor = Color.AliceBlue buttonAppearance.BackColorDisabled = Color.AliceBlue buttonAppearance.ForeColor = Color.DarkBlue ' Set the ButtonAppearance of the relevant controls ' For the UltraComboEditor and UltraFontNameEditor, this appearance ' will be applied to their dropdown buttons. For the UltraNumericEditor ' and UltraCurrencyEditor, it will be applied to the spin buttons, and ' for the UltraDateTimeEditor, it will be applied to both. Me.ultraComboEditor1.ButtonAppearance = buttonAppearance Me.ultraFontNameEditor1.ButtonAppearance = buttonAppearance Me.ultraDateTimeEditor1.ButtonAppearance = buttonAppearance Me.ultraNumericEditor1.ButtonAppearance = buttonAppearance Me.ultraCurrencyEditor1.ButtonAppearance = buttonAppearance ' If the UltraComboEditor control has no items, add some now If (Me.UltraComboEditor1.Items.Count = 0) Then Me.UltraComboEditor1.Items.Add(1, "One") Me.UltraComboEditor1.Items.Add(2, "Two") Me.UltraComboEditor1.Items.Add(3, "Three") End If ' Set the ItemAppearance of the relevant controls to use the ' ButtonAppearance Me.UltraComboEditor1.ItemAppearance = Me.UltraComboEditor1.ButtonAppearance Me.UltraFontNameEditor1.ItemAppearance = Me.UltraFontNameEditor1.ButtonAppearance ' Set their ButtonStyle properties as well Me.UltraComboEditor1.ButtonStyle = UIElementButtonStyle.ButtonSoft Me.UltraFontNameEditor1.ButtonStyle = UIElementButtonStyle.ButtonSoft Me.UltraDateTimeEditor1.ButtonStyle = UIElementButtonStyle.ButtonSoft Me.UltraNumericEditor1.ButtonStyle = UIElementButtonStyle.ButtonSoft Me.UltraCurrencyEditor1.ButtonStyle = UIElementButtonStyle.ButtonSoft ' Make the spin buttons visible for the relevant controls Me.UltraDateTimeEditor1.SpinButtonDisplayStyle = ButtonDisplayStyle.Always Me.UltraNumericEditor1.SpinButtonDisplayStyle = ButtonDisplayStyle.Always Me.UltraCurrencyEditor1.SpinButtonDisplayStyle = ButtonDisplayStyle.Always End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinEditors; private void SetupAppearance() { // Create a new Appearance object Infragistics.Win.Appearance appearance = new Infragistics.Win.Appearance(); // Set some of the color properties of the Appearance object appearance.BackColor = Color.White; appearance.BackColor2 = Color.LightBlue; appearance.ForeColor = Color.DarkBlue; // Set the background gradient style appearance.BackGradientStyle = GradientStyle.ForwardDiagonal; // Set the AlwaysInEditMode property to false so gradient drawing // will be enabled when the control does not have the input focus // // Note that this only applies to the controls that use a TextBox for // their edit portion (UltraTextEditor, UltraComboEditor, and UltraFontNameEditor) this.ultraTextEditor1.AlwaysInEditMode = false; this.ultraComboEditor1.AlwaysInEditMode = false; this.ultraFontNameEditor1.AlwaysInEditMode = false; // Set each UltraWinEditor control's Appearance property to the // Appearance object we just created, so they all have the same // appearance this.ultraTextEditor1.Appearance = appearance; this.ultraComboEditor1.Appearance = appearance; this.ultraFontNameEditor1.Appearance = appearance; this.ultraDateTimeEditor1.Appearance = appearance; this.ultraNumericEditor1.Appearance = appearance; this.ultraCurrencyEditor1.Appearance = appearance; // Create another Appearance object that we will assign to the // ButtonAppearance property of the relevant controls Infragistics.Win.Appearance buttonAppearance = new Infragistics.Win.Appearance(); buttonAppearance.BackColor = Color.AliceBlue; buttonAppearance.BackColorDisabled = Color.AliceBlue; buttonAppearance.ForeColor = Color.DarkBlue; // Set the ButtonAppearance of the relevant controls // For the UltraComboEditor and UltraFontNameEditor, this appearance // will be applied to their dropdown buttons. For the UltraNumericEditor // and UltraCurrencyEditor, it will be applied to the spin buttons, and // for the UltraDateTimeEditor, it will be applied to both. this.ultraComboEditor1.ButtonAppearance = buttonAppearance; this.ultraFontNameEditor1.ButtonAppearance = buttonAppearance; this.ultraDateTimeEditor1.ButtonAppearance = buttonAppearance; this.ultraNumericEditor1.ButtonAppearance = buttonAppearance; this.ultraCurrencyEditor1.ButtonAppearance = buttonAppearance; // If the UltraComboEditor control has no items, add some now if ( this.ultraComboEditor1.Items.Count == 0 ) { this.ultraComboEditor1.Items.Add( 1, "One" ); this.ultraComboEditor1.Items.Add( 2, "Two" ); this.ultraComboEditor1.Items.Add( 3, "Three" ); } // Set the ItemAppearance of the relevant controls to use the // ButtonAppearance this.ultraComboEditor1.ItemAppearance = this.ultraComboEditor1.ButtonAppearance; this.ultraFontNameEditor1.ItemAppearance = this.ultraFontNameEditor1.ButtonAppearance; // Set their ButtonStyle properties as well this.ultraComboEditor1.ButtonStyle = UIElementButtonStyle.ButtonSoft; this.ultraFontNameEditor1.ButtonStyle = UIElementButtonStyle.ButtonSoft; this.ultraDateTimeEditor1.ButtonStyle = UIElementButtonStyle.ButtonSoft; this.ultraNumericEditor1.ButtonStyle = UIElementButtonStyle.ButtonSoft; this.ultraCurrencyEditor1.ButtonStyle = UIElementButtonStyle.ButtonSoft; // Make the spin buttons visible for the relevant controls this.ultraDateTimeEditor1.SpinButtonDisplayStyle = ButtonDisplayStyle.Always; this.ultraNumericEditor1.SpinButtonDisplayStyle = ButtonDisplayStyle.Always; this.ultraCurrencyEditor1.SpinButtonDisplayStyle = ButtonDisplayStyle.Always; }