'宣言 Public Property DisplayStyle As Infragistics.Win.EmbeddableElementDisplayStyle
public Infragistics.Win.EmbeddableElementDisplayStyle DisplayStyle {get; set;}
UltraNumericEditorBase コントロールが実行しているオペレーティング システムにかかわらず、DisplayStyleプロパティを適切に設定することによって、列のボタンは、Office2000、OfficeXP、または Office2003 に表示される表示スタイルを視覚的にエミュレートできます。
注: コントロールの DisplayStyle プロパティが Standard 以外に設定されると、BorderStyle プロパティは適用されません。
Imports Infragistics.Win Imports Infragistics.Win.UltraWinEditors Private Enum OS WindowsXP Windows2000 Windows9X End Enum Private Sub SetupDisplayStyle() If GetOS() = OS.WindowsXP Then ' If the client machine is running WindowsXP, set the DisplayStyle property to OfficeXP Me.UltraTextEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.OfficeXP Me.UltraComboEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.OfficeXP Me.UltraFontNameEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.OfficeXP Me.UltraDateTimeEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.OfficeXP Me.UltraNumericEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.OfficeXP Me.UltraCurrencyEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.OfficeXP ElseIf GetOS() = OS.Windows2000 Then ' If the client machine is running Windows2000, set the DisplayStyle property to Office2000 Me.UltraTextEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Office2000 Me.UltraComboEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Office2000 Me.UltraFontNameEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Office2000 Me.UltraDateTimeEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Office2000 Me.UltraNumericEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Office2000 Me.UltraCurrencyEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Office2000 Else ' If the client machine is running neither, set the DisplayStyle property to Standard Me.UltraTextEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Standard Me.UltraComboEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Standard Me.UltraFontNameEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Standard Me.UltraDateTimeEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Standard Me.UltraNumericEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Standard Me.UltraCurrencyEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Standard ' Set the BorderStyle property to Inset Me.UltraTextEditor1.BorderStyle = Infragistics.Win.UIElementBorderStyle.Inset Me.UltraComboEditor1.BorderStyle = Infragistics.Win.UIElementBorderStyle.Inset Me.UltraFontNameEditor1.BorderStyle = Infragistics.Win.UIElementBorderStyle.Inset Me.UltraDateTimeEditor1.BorderStyle = Infragistics.Win.UIElementBorderStyle.Inset Me.UltraNumericEditor1.BorderStyle = Infragistics.Win.UIElementBorderStyle.Inset Me.UltraCurrencyEditor1.BorderStyle = Infragistics.Win.UIElementBorderStyle.Inset End If End Sub ' Returns the operating system running on the client machine Private Function GetOS() As OS Dim opSys As OperatingSystem = System.Environment.OSVersion If opSys.Platform = PlatformID.Win32NT Then If opSys.Version.Major > 5 Or (opSys.Version.Major = 5 And opSys.Version.Minor >= 1) Then Return OS.WindowsXP Else Return OS.Windows2000 End If End If Return OS.Windows9X End Function
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinEditors; private enum OS { WindowsXP, Windows2000, Windows9X, } private void SetupDisplayStyle() { if ( GetOS() == OS.WindowsXP ) { // If the client machine is running WindowsXP, set the DisplayStyle property to OfficeXP this.ultraTextEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.OfficeXP; this.ultraComboEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.OfficeXP; this.ultraFontNameEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.OfficeXP; this.ultraDateTimeEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.OfficeXP; this.ultraNumericEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.OfficeXP; this.ultraCurrencyEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.OfficeXP; } else if ( GetOS() == OS.Windows2000 ) { // If the client machine is running Windows2000, set the DisplayStyle property to Office2000 this.ultraTextEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Office2000; this.ultraComboEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Office2000; this.ultraFontNameEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Office2000; this.ultraDateTimeEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Office2000; this.ultraNumericEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Office2000; this.ultraCurrencyEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Office2000; } else { // If the client machine is running neither, set the DisplayStyle property to Standard this.ultraTextEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Standard; this.ultraComboEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Standard; this.ultraFontNameEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Standard; this.ultraDateTimeEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Standard; this.ultraNumericEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Standard; this.ultraCurrencyEditor1.DisplayStyle = Infragistics.Win.EmbeddableElementDisplayStyle.Standard; // Set the BorderStyle property to Inset this.ultraTextEditor1.BorderStyle = Infragistics.Win.UIElementBorderStyle.Inset; this.ultraComboEditor1.BorderStyle = Infragistics.Win.UIElementBorderStyle.Inset; this.ultraFontNameEditor1.BorderStyle = Infragistics.Win.UIElementBorderStyle.Inset; this.ultraDateTimeEditor1.BorderStyle = Infragistics.Win.UIElementBorderStyle.Inset; this.ultraNumericEditor1.BorderStyle = Infragistics.Win.UIElementBorderStyle.Inset; this.ultraCurrencyEditor1.BorderStyle = Infragistics.Win.UIElementBorderStyle.Inset; } } // Returns the operating system running on the client machine private OS GetOS() { OperatingSystem opSys = System.Environment.OSVersion; if ( opSys.Platform == PlatformID.Win32NT ) { if ( opSys.Version.Major > 5 || (opSys.Version.Major == 5 && opSys.Version.Minor >= 1) ) return OS.WindowsXP; else return OS.Windows2000; } return OS.Windows9X; }