'宣言 Public Property SizingMode As PanelSizingMode
public PanelSizingMode SizingMode {get; set;}
パネルは 4 つのサイズ モードをサポートします。
サイズ設定モード | |
---|---|
Automatic | 幅はコンテンツに基づきます (AutoSizeWidth) |
Adjustable | Width は現在のサイズを決定しますが、パネルは、パネルの右端をドラッグしてエンドユーザーがサイズ変更できます。 |
Fixed | Width プロパティが使用されます。 |
Spring | それぞれの表示可能なパネルにスペースを割り当てた後に使用できる領域は、Spring サイズのモード パネルすべてに配分されます。 |
一部のパネル スタイル (つまり、Progress、ControlContainer および MDIList) では Automatic は無効で計算できません。
Imports Infragistics.Win Imports Infragistics.Win.UltraWinStatusBar Imports Infragistics.Win.UltraWinProgressBar Private Sub InitializeStatusBar() With Me.ultraStatusBar1 ' Note: Under windows XP if the 'SupportThemes' property ' is left is True (its default setting) then some of ' the explicit appearance, border style and button ' style properties are ignored. .SupportThemes = False ' Set the border style for the status bar control .BorderStyle = UIElementBorderStyle.InsetSoft ' Set the default border style for panels .BorderStylePanel = UIElementBorderStyle.InsetSoft ' Set the style for button type panels .ButtonStyle = UIElementButtonStyle.PopupSoftBorderless ' Set the # of pixels between panels .InterPanelSpacing = 3 ' Specify the margins inside the status bar control. .Padding = New UIElementMargins(2, 1, 1, 2) ' Set some apperance setting for the control .Appearance.BackGradientStyle = GradientStyle.VerticalBump .Appearance.BackColor = Color.Blue .Appearance.BackColor2 = Color.Aqua ' Set the default appearance for panels .PanelAppearance.BackColor = Color.Transparent ' Set some additional properties on the control .PanelsVisible = True .ResizeStyle = ResizeStyle.Immediate .ScaledImageSize = New Size(8, 8) .ScaleImages = ScaleImage.OnlyWhenNeeded .ShowToolTips = True .SizeGripVisible = DefaultableBoolean.True .UseMnemonic = True .WrapText = True End With ' Add some panels to the collection Dim panel As UltraStatusPanel ' Add a simple text panel panel = Me.ultraStatusBar1.Panels.Add("P1", PanelStyle.Text) panel.Text = "some text" ' Add an auto status text style panel. ' Note: At design time a 'StatusBarText' extender property ' is added to each control and menu on the form. ' At runtime, when the mouse is over the control the text ' specified for this property will display in the AutoStatusText ' panel. ' Also a panel of this type will automatically show the ' tooltip for tools on an UltraToolbarsManager toolbar or menu. panel = Me.ultraStatusBar1.Panels.Add("P2", PanelStyle.AutoStatusText) panel.SizingMode = PanelSizingMode.Spring ' You can also set the 'StatusBarText' extender property in ' code by calling the 'SetStatusBarText' method as illustrated below. Me.ultraStatusBar1.SetStatusBarText(Me.button1, "Btn 1 action desc...") Me.ultraStatusBar1.SetStatusBarText(Me.button2, "Btn 2 action desc...") ' Add a character position style panel panel = Me.ultraStatusBar1.Panels.Add("P3", PanelStyle.CharacterPosition) panel.Control = Me.richTextBox1 panel.CharacterPositionFormat = "Ln: [Line], Char: [Char]" panel.SizingMode = PanelSizingMode.Fixed panel.BorderStyle = UIElementBorderStyle.None panel.Width = 100 ' Add a cursor position style panel panel = Me.ultraStatusBar1.Panels.Add("P4", PanelStyle.CursorPosition) ' You must specify either the form or a control so that ' when the mouse is moved over that control the panel ' will be automatically updated. panel.Control = Me.richTextBox1 panel.CursorPositionFormat = "x: [X], y: [Y]" panel.SizingMode = PanelSizingMode.Automatic ' Add a button style panel panel = Me.ultraStatusBar1.Panels.Add("P5", PanelStyle.Button) panel.Text = "&End" panel.Appearance.TextHAlign = HAlign.Center panel.ToolTipText = "Scrolls to the end of the document" panel.Enabled = True ' Add a state button style panel panel = Me.ultraStatusBar1.Panels.Add("P6", PanelStyle.StateButton) panel.Text = "&Hex" panel.Checked = True ' Add a control container style panel panel = Me.ultraStatusBar1.Panels.Add("P7", PanelStyle.ControlContainer) panel.SizingMode = PanelSizingMode.Adjustable panel.MinWidth = 50 panel.Control = Me.textBox1 panel.Padding = New Size(3, 6) ' Add a date style panel panel = Me.ultraStatusBar1.Panels.Add("P8", PanelStyle.Date) panel.DateTimeFormat = "MMM-dd-yyyy" ' Add a time style panel panel = Me.ultraStatusBar1.Panels.Add("P9", PanelStyle.Time) panel.DateTimeFormat = "hh:mm:ss tt" ' Add a key state style panel panel = Me.ultraStatusBar1.Panels.Add("P10", PanelStyle.KeyState) panel.KeyStateInfo.DisplayStyle = KeyStateDisplayStyle.ChangeText panel.KeyStateInfo.Key = KeyState.InsertMode panel.KeyStateInfo.OffText = "Ovr" panel.KeyStateInfo.OnText = "Insrt" ' Add a marquee style panel panel = Me.ultraStatusBar1.Panels.Add("P11", PanelStyle.Marquee) panel.Text = "marquee string" panel.MarqueeInfo.Delay = 50 panel.MarqueeInfo.MarqueeStyle = MarqueeStyle.Bouncing panel.MarqueeInfo.MarqueeDirection = Direction.LeftToRight panel.MarqueeInfo.MarqueeScrollAmount = 2 panel.MarqueeInfo.Start() ' Add a progress style panel panel = Me.ultraStatusBar1.Panels.Add("P12", PanelStyle.Progress) With panel.ProgressBarInfo .Appearance.ForeColor = Color.Red .FillAppearance.BackColor = Color.Blue .FillAppearance.ForeColor = Color.Yellow .Minimum = 25 .Maximum = 85 .Value = 50 .ShowLabel = True .Style = ProgressBarStyle.SegmentedPartial .PercentFormat = "P2" .Label = _ "Done: " + _ UltraProgressBar.LABEL_FORMATTED + _ "Remaining: " + _ UltraProgressBar.LABEL_FORMATTED_REMAINING End With ' There is also an 'MDIList' style tool for use ' on MDI parent forms. End Sub
using System.Diagnostics; using Infragistics.Win; using Infragistics.Win.UltraWinStatusBar; using Infragistics.Win.UltraWinProgressBar; private void InitializeStatusBar() { // Note: Under windows XP if the 'SupportThemes' property // is left is True (its default setting) then some of // the explicit appearance, border style and button // style properties are ignored. this.ultraStatusBar1.SupportThemes = false; // Set the border style for the status bar control this.ultraStatusBar1.BorderStyle = UIElementBorderStyle.InsetSoft; // Set the default border style for panels this.ultraStatusBar1.BorderStylePanel = UIElementBorderStyle.InsetSoft; // Set the style for button type panels this.ultraStatusBar1.ButtonStyle = UIElementButtonStyle.PopupSoftBorderless; // Set the # of pixels between panels this.ultraStatusBar1.InterPanelSpacing = 3; // Specify the margins inside the status bar control. this.ultraStatusBar1.Padding = new UIElementMargins(2, 1,1,2); // Set some apperance setting for the control this.ultraStatusBar1.Appearance.BackGradientStyle = GradientStyle.VerticalBump; this.ultraStatusBar1.Appearance.BackColor = Color.Blue; this.ultraStatusBar1.Appearance.BackColor2 = Color.Aqua; // Set the default appearance for panels this.ultraStatusBar1.PanelAppearance.BackColor = Color.Transparent; // Set some additional properties on the control this.ultraStatusBar1.PanelsVisible = true; this.ultraStatusBar1.ResizeStyle = ResizeStyle.Immediate; this.ultraStatusBar1.ScaledImageSize = new Size(8,8); this.ultraStatusBar1.ScaleImages = ScaleImage.OnlyWhenNeeded; this.ultraStatusBar1.ShowToolTips = true; this.ultraStatusBar1.SizeGripVisible = DefaultableBoolean.True; this.ultraStatusBar1.UseMnemonic = true; this.ultraStatusBar1.WrapText = true; // Add some panels to the collection UltraStatusPanel panel; // Add a simple text panel panel = this.ultraStatusBar1.Panels.Add("P1", PanelStyle.Text ); panel.Text = "some text"; // Add an auto status text style panel. // Note: At design time a 'StatusBarText' extender property // is added to each control and menu on the form. // At runtime, when the mouse is over the control the text // specified for this property will display in the AutoStatusText // panel. // Also a panel of this type will automatically show the // tooltip for tools on an UltraToolbarsManager toolbar or menu. panel = this.ultraStatusBar1.Panels.Add("P2", PanelStyle.AutoStatusText ); panel.SizingMode = PanelSizingMode.Spring; // You can also set the 'StatusBarText' extender property in // code by calling the 'SetStatusBarText' method as illustrated below. this.ultraStatusBar1.SetStatusBarText( this.button1, "Btn 1 action desc..."); this.ultraStatusBar1.SetStatusBarText( this.button2, "Btn 2 action desc..."); // Add a character position style panel panel = this.ultraStatusBar1.Panels.Add("P3", PanelStyle.CharacterPosition ); panel.Control = this.richTextBox1; panel.CharacterPositionFormat = "Ln: [Line], Char: [Char]"; panel.SizingMode = PanelSizingMode.Fixed; panel.BorderStyle = UIElementBorderStyle.None; panel.Width = 100; // Add a cursor position style panel panel = this.ultraStatusBar1.Panels.Add("P4", PanelStyle.CursorPosition ); // You must specify either the form or a control so that // when the mouse is moved over that control the panel // will be automatically updated. panel.Control = this.richTextBox1; panel.CursorPositionFormat = "x: [X], y: [Y]"; panel.SizingMode = PanelSizingMode.Automatic; // Add a button style panel panel = this.ultraStatusBar1.Panels.Add("P5", PanelStyle.Button ); panel.Text = "&End"; panel.Appearance.TextHAlign = HAlign.Center; panel.ToolTipText = "Scrolls to the end of the document"; panel.Enabled = true; // Add a state button style panel panel = this.ultraStatusBar1.Panels.Add("P6", PanelStyle.StateButton ); panel.Text = "&Hex"; panel.Checked = true; // Add a control container style panel panel = this.ultraStatusBar1.Panels.Add("P7", PanelStyle.ControlContainer ); panel.SizingMode = PanelSizingMode.Adjustable; panel.MinWidth = 50; panel.Control = this.textBox1; panel.Padding = new Size(3,6); // Add a date style panel panel = this.ultraStatusBar1.Panels.Add("P8", PanelStyle.Date ); panel.DateTimeFormat = "MMM-dd-yyyy"; // Add a time style panel panel = this.ultraStatusBar1.Panels.Add("P9", PanelStyle.Time ); panel.DateTimeFormat = "hh:mm:ss tt"; // Add a key state style panel panel = this.ultraStatusBar1.Panels.Add("P10", PanelStyle.KeyState ); panel.KeyStateInfo.DisplayStyle = KeyStateDisplayStyle.ChangeText; panel.KeyStateInfo.Key = KeyState.InsertMode; panel.KeyStateInfo.OffText = "Ovr"; panel.KeyStateInfo.OnText = "Insrt"; // Add a marquee style panel panel = this.ultraStatusBar1.Panels.Add("P11", PanelStyle.Marquee ); panel.Text = "some marquee string"; panel.MarqueeInfo.Delay = 50; panel.MarqueeInfo.MarqueeStyle = MarqueeStyle.Bouncing; panel.MarqueeInfo.MarqueeDirection = Direction.LeftToRight; panel.MarqueeInfo.MarqueeScrollAmount = 2; panel.MarqueeInfo.Start(); // Add a progress style panel panel = this.ultraStatusBar1.Panels.Add("P12", PanelStyle.Progress ); ProgressBarInfo pbi = panel.ProgressBarInfo; pbi.Appearance.ForeColor = Color.Red; pbi.FillAppearance.BackColor = Color.Blue; pbi.FillAppearance.ForeColor = Color.Yellow; pbi.Minimum = 0; pbi.Maximum = 100; pbi.ShowLabel = true; pbi.Style = ProgressBarStyle.SegmentedPartial; pbi.PercentFormat = "P2"; // Note: There are 10 different substitution string // constants defined by UltraProgressBar that are // prefixed by "LABEL_". The actual values are then // substituted for these constants to format the // label that is displayed in the panel. pbi.Label = "Done: " + UltraProgressBar.LABEL_FORMATTED + "Remaining: " + UltraProgressBar.LABEL_FORMATTED_REMAINING ); pbi.Value = 50; // There is also an 'MDIList' style tool for use // on MDI parent forms. }