'宣言 Public Property Appearance As Infragistics.Win.AppearanceBase
public Infragistics.Win.AppearanceBase Appearance {get; set;}
Imports Infragistics.Win Imports Infragistics.Win.UltraWinProgressBar Imports Infragistics.Win.UltraWinStatusBar Private Sub button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button3.Click Dim panel As UltraStatusPanel Dim pbi As ProgressBarInfo ' Note: Under windows XP if the 'SupportThemes' property ' is left set to True (its default setting) then some of ' the appearance settings are ignored. Me.ultraStatusBar1.SupportThemes = False ' Add a progress style panel to the status bar. Panel = Me.ultraStatusBar1.Panels.Add("Pgrss", PanelStyle.Progress) ' Set the index of the panel so that it is the first ' visible panel Panel.Index = 0 ' Set the width of the panel panel.Width = 200 ' Get the 'ProgressBarInfo' object from the panel. ' Note: This has meaning only for panels with a ' 'Style' of 'PanelStyle.Progress'. pbi = Panel.ProgressBarInfo ' Set the appearance of the status bar control ' to use a gradient. pbi.Appearance.BackColor = Color.Gray pbi.Appearance.BackColor2 = Color.White pbi.Appearance.BackGradientStyle = GradientStyle.VerticalBump pbi.Appearance.ForeColor = Color.Red pbi.Appearance.TextHAlign = HAlign.Right ' Set the appearance for the 'fill' area of the ' status bar control to use a different gradient. pbi.FillAppearance.BackColor = Color.Blue pbi.FillAppearance.BackColor2 = Color.White pbi.FillAppearance.BackGradientStyle = GradientStyle.VerticalBump pbi.FillAppearance.ForeColor = Color.Red ' Set the minimum, maximum, and value properties. ' For the case below where the minimum value is 45, ' the maximum is 85 and the value is 55, the status ' bar would display 25%. This is because the entire ' range is 40 (85 - 45) and the relative value is 10 ' (55 - 45). pbi.Minimum = 45 pbi.Maximum = 85 pbi.Value = 55 ' Set a percent format. The default format is ' "P0" which shows only the percent integer ' value. The "P1" setting below will format ' the percentage with place after the decimal ' point (e.g.. "34.5%"). pbi.PercentFormat = "P1" ' Set the 'Label' property to a string that ' contains some substitution strings. The ' code below will cause the panel to display ' its value formatted like the following: ' "Done: 34.4, remaining" Dim sb As New System.Text.StringBuilder() ' Note: There are 10 different substitution string ' constants defined on UltraProgressBar. They are ' prefixed with 'LABEL_'. ' ' The LABEL_FORMATTED substitution string ' will cause the formatted percent completed ' value to be substitued here. sb.Append("Done: ") sb.Append(UltraProgressBar.LABEL_FORMATTED) ' The LABEL_FORMATTED_REMAINING substitution ' string will cause the formatted percent ' remaining value to be substitued here. sb.Append(", remaining: ") sb.Append(UltraProgressBar.LABEL_FORMATTED_REMAINING) ' Set the 'Label' property of the control. pbi.Label = sb.ToString() ' Set the style of the progress bar to show a ' segmented fill. pbi.Style = ProgressBarStyle.SegmentedPartial ' Set the ShowLabel property. The default ' value is true so the line below isn't ' required. pbi.ShowLabel = True End Sub
using Infragistics.Win; using Infragistics.Win.UltraWinProgressBar; using Infragistics.Win.UltraWinStatusBar; private void button3_Click(object sender, System.EventArgs e) { UltraStatusPanel panel; ProgressBarInfo pbi; // Note: Under windows XP if the 'SupportThemes' property // is left set to True (its default setting) then some of // the appearance settings are ignored. this.ultraStatusBar1.SupportThemes = false; // Add a progress style panel to the status bar. panel = this.ultraStatusBar1.Panels.Add("Pgrss", PanelStyle.Progress ); // Set the index of the panel so that it is the first // visible panel panel.Index = 0; // Set the width of the panel panel.Width = 200; // Get the 'ProgressBarInfo' object from the panel. // Note: This has meaning only for panels with a // 'Style' of 'PanelStyle.Progress'. pbi = panel.ProgressBarInfo; // Set the appearance of the status bar control // to use a gradient. pbi.Appearance.BackColor = Color.Gray; pbi.Appearance.BackColor2 = Color.White; pbi.Appearance.BackGradientStyle = GradientStyle.VerticalBump; pbi.Appearance.ForeColor = Color.Red; pbi.Appearance.TextHAlign = HAlign.Right; // Set the appearance for the 'fill' area of the // status bar control to use a different gradient. pbi.FillAppearance.BackColor = Color.Blue; pbi.FillAppearance.BackColor2 = Color.White; pbi.FillAppearance.BackGradientStyle = GradientStyle.VerticalBump; pbi.FillAppearance.ForeColor = Color.Red; // Set the minimum, maximum, and value properties. // For the case below where the minimum value is 45, // the maximum is 85 and the value is 55, the status // bar would display 25%. This is because the entire // range is 40 (85 - 45) and the relative value is 10 // (55 - 45). pbi.Minimum = 45; pbi.Maximum = 85; pbi.Value = 55; // Set a percent format. The default format is // "P0" which shows only the percent integer // value. The "P1" setting below will format // the percentage with place after the decimal // point (e.g.. "34.5%"). pbi.PercentFormat = "P1"; // Set the 'Label' property to a string that // contains some substitution strings. The // code below will cause the panel to display // its value formatted like the following: // "Done: 34.4, remaining" System.Text.StringBuilder sb = new System.Text.StringBuilder(); // Note: There are 10 different substitution string // constants defined on UltraProgressBar. They are // prefixed with 'LABEL_'. // // The LABEL_FORMATTED substitution string // will cause the formatted percent completed // value to be substitued here. sb.Append( "Done: "); sb.Append( UltraProgressBar.LABEL_FORMATTED ); // The LABEL_FORMATTED_REMAINING substitution // string will cause the formatted percent // remaining value to be substitued here. sb.Append( ", remaining: "); sb.Append( UltraProgressBar.LABEL_FORMATTED_REMAINING ); // Set the 'Label' property of the control. pbi.Label = sb.ToString(); // Set the style of the progress bar to show a // segmented fill. pbi.Style = ProgressBarStyle.SegmentedPartial; // Set the ShowLabel property. The default // value is true so the line below isn't // required. pbi.ShowLabel = true; }