RibbonStrip - harborsiem/WinForms-Ribbon GitHub Wiki

RibbonStrip

Main class, derived from System.Windows.Forms.Control. This class can be placed by the WinForms designer to a Form with Top docking.

Public constructors, methods, properties and events:

Constructors:

Name Description
RibbonStrip() Initializes a new instance of the RibbonStrip class.

Methods:

Name Description
LoadSettingsFromStream(Stream) The LoadSettingsFromStream method is useful for persisting ribbon state, such as Quick Access Toolbar (QAT) items, across application instances. See also property QatSettingsFile.
SaveSettingsToStream(Stream) The SaveSettingsToStream method is useful for persisting ribbon state, such as Quick Access Toolbar (QAT) items, across application instances. See also property QatSettingsFile.
SetBackgroundColor(UI_HSBCOLOR) Method for color handling to the ribbon. Change ribbon background colors.
SetHighlightColor(UI_HSBCOLOR) Method for color handling to the ribbon. Change ribbon highlight colors.
SetTextColor(UI_HSBCOLOR) Method for color handling to the ribbon. Change ribbon text colors.
SetApplicationButtonColor(UI_HSBCOLOR) Method for color handling to the ribbon. Change ribbon application button color.
GetBackgroundColor() (UI_HSBCOLOR) Methods for color handling to the ribbon. Get ribbon background color.
GetHighlightColor() (UI_HSBCOLOR) Methods for color handling to the ribbon. Get ribbon highlight color.
GetTextColor() (UI_HSBCOLOR) Methods for color handling to the ribbon. Get ribbon text color.
GetApplicationButtonColor() (UI_HSBCOLOR) Methods for color handling to the ribbon. Get ribbon application button color.
SetModes(params byte[]) Set current application modes. Values between 0 and 31 allowed. Example: SetModes(0, 3, 5). The current ApplicationModes are now 0, 3 and 5.
ShowContextPopup(uint, int, int) Shows a predefined context popup at a specific location. The first parameter is the Command Id of the popup. The other parameters are the screen position for the popup.
SetDarkModeRibbon(bool) Darkmode or Lightmode for the Ribbon. Newer Windows version required.
GetDarkModeRibbon() (bool) Darkmode or Lightmode for the Ribbon. Newer Windows version required.
GetRibbonControlById(uint) (IRibbonControl) Get a ribbon control by CommandId.

Design time Properties:

Name Description
MarkupHeader (string) MarkupHeader is a reference to an embedded resource file in your project, which contains the RibbonMarkup.h from the build process with the RibbonTools64. Set the Property MarkupHeader of the RibbonStrip to 'Default namespace of your application assembly'.RibbonMarkup.h. [Optional]
MarkupResource (string) MarkupResource is a reference to an embedded resource file in your project, which contains the compiled RibbonMarkup.xml from the build process with the RibbonTools64. Set the Property MarkupResource of the RibbonStrip to 'Default namespace of your application assembly'.RibbonMarkup.ribbon. The RibbonStrip property MarkupResource can also be a file-based resource file. In case of a file-based resource file the name must start with file:// like a Uri path. If the RibbonMarkup.ribbon is located in the same path as the application.exe, then you can define MarkupResource = file://RibbonMarkup.ribbon If you have a special directory for the path you can also write MarkupResource = file://{LocalApplicationData}/your_path/RibbonMarkup.ribbon. Localization is also supported with the file-based resource file. Names of special directories one can find in Environment.SpecialFolder
ResourceIdentifier (string) If you not use the default name parameter for the ribbon compiler uicc.exe, you can set it here. Normally leave this property empty (null).
ShortcutTableResourceName (string) In the shortcut file are definitions to the markup commands and their corresponding shortcut keys. Add this file to your project as an embedded resource. The shortcut table is optional. Set the RibbonStrip Property ShortcutTableResourceName to 'Default namespace of your application assembly.name-of-the-shortcut-file' or leave it empty.
QatSettingsFile (string) Qat settings are load / stored from / to LocalAppData\"AssemblyName".

Properties:

Name Description
EventLogger Gives you an instance of the EventLogger class. (Windows 8 and later)
IsInitialized Check if ribbon framework has been initialized.
Minimized Specifies whether the ribbon is in a collapsed or expanded state.
QuickAccessToolbarDock Specifies whether the quick access toolbar is docked at the top or at the bottom.
ApplicationButtonColor Get, Set color of application button. Newer Windows version required.
DarkModeRibbon Get, Set Darkmode or Lightmode for the Ribbon. Newer Windows version required.
MarkupHandle The LoadLibrary handle for MarkupResource.

Events:

Name Description
RibbonEventException User can handle untrapped Exceptions in the other events of the Ribbon controls like RibbonButton Click event.
RibbonHeightChanged This event fires when the RibbonStrip height changed.
ViewCreated This event fired when the view is created. You can use it for loading the settings.
ViewDestroy This event fired when the view is in destroy. You can use it for saving the settings.