Mode: RibbonProgressBarMode;
The Mode property determines a mode of component progress bar displaying.
Two modes of progress bar displaying are available for the component: standard () and infinite ().
Visual displaying of the animated progress bar in the infinite mode is available if the following formatting themes are used:
Microsoft Office 2007.
Microsoft Office 2010.
Carbon.
Windows 7 (when using Windows 7 operating system and activated Aero formatting theme).
Executing the example requires a form, the Ribbon component named Ribbon1 on it, the Timer component named Timer1 and two buttons named Button1 and Button2. The buttons are used to activate and deactivate a timer. The ribbon is loaded to the Ribbon1 component. Two progress bars are placed on the first panel of the active ribbon tab.
Class TestForm: Form
Ribbon1: Ribbon;
Button1: Button;
Button2: Button;
Timer1: Timer;
Progress1, Progress2: IRibbonProgressBar;
i: Integer;
Const MaxValue = 100;
Sub TestFormOnCreate(Sender: Object; Args: IEventArgs);
Var
RPanel: IRibbonPanel;
Begin
RPanel := Ribbon1.ActiveCategory.Panels.Item(0);
Progress1 := RPanel.Elements.Item(0) As IRibbonProgressBar;
Progress2 := RPanel.Elements.Item(1) As IRibbonProgressBar;
Progress1.Mode := RibbonProgressBarMode.Infinite;
Progress2.Mode := RibbonProgressBarMode.Normal;
Progress1.Maximum := MaxValue;
Progress2.Maximum := MaxValue;
End Sub TestFormOnCreate;
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Begin
Timer1.Enabled := True;
End Sub Button1OnClick;
Sub Button2OnClick(Sender: Object; Args: IMouseEventArgs);
Begin
Timer1.Enabled := False;
End Sub Button2OnClick;
Sub Timer1OnTimer(Sender: Object; Args: IEventArgs);
Begin
If i = MaxValue Then
i := 0;
End If;
i := i + 1;
Progress1.Value := i;
Progress2.Value := i;
End Sub Timer1OnTimer;
End Class TestForm;
Clicking the Button1 button activates the timer after form startup. The value that is displayed on the progress bars is changed in the timer event. If the Carbon formatting theme is used, the process looks visually as follows:
See also: