ResourceProvider Class
- Namespace
TXTextControl.Windows. Forms
- Package
TXTextControl.from the private NuGet feed or Text Control Offline PackagesTextControl. WinForms. SDK
- Assembly
TXTextControl.Windows. Forms. dll
- Install
dotnet add package TXTextControl..NET 8 and later. For .NET Framework, referenceTextControl. WinForms. SDK TXTextControl.from the setup.Windows. Forms. dll
Description
The ResourceProvider class provides static methods to receive bitmaps or strings from sources that can be accessed via an assigned identifier.
Syntax
public class ResourceProviderPublic Class ResourceProviderExamples
The following examples shows how to create a RibbonSplitButton with the appearance of a ResourceProvider.FileMenuItems.TXITEM_Print button including two drop down items using the ResourceProvider class.
// Get current Dpi value
Graphics g = this.CreateGraphics();
float dpi = g.DpiX;
g.Dispose();
// Create large print ribbon split button
RibbonSplitButton printButton = new RibbonSplitButton();
printButton.LargeIcon = ResourceProvider.GetLargeIcon(ResourceProvider.FileMenuItem.TXITEM_Print.ToString(), dpi);
printButton.SmallIcon = ResourceProvider.GetSmallIcon(ResourceProvider.FileMenuItem.TXITEM_Print.ToString(), dpi);
printButton.Text = ResourceProvider.GetText(ResourceProvider.FileMenuItem.TXITEM_Print.ToString());
printButton.KeyTip = ResourceProvider.GetKeyTip(ResourceProvider.FileMenuItem.TXITEM_Print.ToString());
// Create two drop down buttons
// 1. An Open Print Dialog button
RibbonButton printDropDownItem = new RibbonButton() { DisplayMode = IconTextRelation.SmallIconLabeled };
printDropDownItem.SmallIcon = ResourceProvider.GetSmallIcon(ResourceProvider.FileMenuItem.TXITEM_Print.ToString(), dpi);
printDropDownItem.Text = ResourceProvider.GetText(ResourceProvider.FileMenuItem.TXITEM_Print.ToString());
printDropDownItem.ToolTip.Title = ResourceProvider.GetToolTipTitle(ResourceProvider.FileMenuItem.TXITEM_Print.ToString());
printDropDownItem.ToolTip.Description = ResourceProvider.GetToolTipDescription(ResourceProvider.FileMenuItem.TXITEM_Print.ToString());
printButton.DropDownItems.Add(printDropDownItem);
// 2. A Print Preview Button
printDropDownItem = new RibbonButton() { DisplayMode = IconTextRelation.SmallIconLabeled };
printDropDownItem.SmallIcon = ResourceProvider.GetSmallIcon(ResourceProvider.FileMenuItem.TXITEM_PrintPreview.ToString(), dpi);
printDropDownItem.Text = ResourceProvider.GetText(ResourceProvider.FileMenuItem.TXITEM_PrintPreview.ToString());
printDropDownItem.ToolTip.Title = ResourceProvider.GetToolTipTitle(ResourceProvider.FileMenuItem.TXITEM_PrintPreview.ToString());
printDropDownItem.ToolTip.Description = ResourceProvider.GetToolTipDescription(ResourceProvider.FileMenuItem.TXITEM_PrintPreview.ToString());
printButton.DropDownItems.Add(printDropDownItem);
ribbonGroup.RibbonItems.Add(printButton);' Get current Dpi value
Dim g As Graphics = Me.CreateGraphics
Dim dpi As Single = g.DpiX
g.Dispose
' Create large print ribbon split button
Dim printButton As RibbonSplitButton = New RibbonSplitButton
printButton.LargeIcon = ResourceProvider.GetLargeIcon(ResourceProvider.FileMenuItem.TXITEM_Print.ToString, dpi)
printButton.SmallIcon = ResourceProvider.GetSmallIcon(ResourceProvider.FileMenuItem.TXITEM_Print.ToString, dpi)
printButton.Text = ResourceProvider.GetText(ResourceProvider.FileMenuItem.TXITEM_Print.ToString)
printButton.KeyTip = ResourceProvider.GetKeyTip(ResourceProvider.FileMenuItem.TXITEM_Print.ToString)
' Create two drop down button
' 1. An Open Print Dialog button
Dim printDropDownItem As RibbonButton = New RibbonButton
printDropDownItem.SmallIcon = ResourceProvider.GetSmallIcon(ResourceProvider.FileMenuItem.TXITEM_Print.ToString, dpi)
printDropDownItem.Text = ResourceProvider.GetText(ResourceProvider.FileMenuItem.TXITEM_Print.ToString)
printDropDownItem.ToolTip.Title = ResourceProvider.GetToolTipTitle(ResourceProvider.FileMenuItem.TXITEM_Print.ToString)
printDropDownItem.ToolTip.Description = ResourceProvider.GetToolTipDescription(ResourceProvider.FileMenuItem.TXITEM_Print.ToString)
printButton.DropDownItems.Add(printDropDownItem)
' 2. A Print Preview Button
printDropDownItem = New RibbonButton
printDropDownItem.SmallIcon = ResourceProvider.GetSmallIcon(ResourceProvider.FileMenuItem.TXITEM_PrintPreview.ToString, dpi)
printDropDownItem.Text = ResourceProvider.GetText(ResourceProvider.FileMenuItem.TXITEM_PrintPreview.ToString)
printDropDownItem.ToolTip.Title = ResourceProvider.GetToolTipTitle(ResourceProvider.FileMenuItem.TXITEM_PrintPreview.ToString)
printDropDownItem.ToolTip.Description = ResourceProvider.GetToolTipDescription(ResourceProvider.FileMenuItem.TXITEM_PrintPreview.ToString)
printButton.DropDownItems.Add(printDropDownItem)
ribbonGroup.RibbonItems.Add(printButton)The following example includes a Resource Provider object in application diagnostics. The created object is then available to the surrounding document workflow.
Console.WriteLine(resourceProvider);
Console.WriteLine("Resource Provider is ready for use.");Console.WriteLine(resourceProvider)
Console.WriteLine("Resource Provider is ready for use.")Members
Methods
| Method | Description |
|---|---|
| GetKeyTip | Gets the key tip that is associated with an item and specified by the identifier parameter. Such an identifier can be the string conversion of an enumeration that is associated with an item (such as RibbonFormattingTab.RibbonItem.TXITEM_Paste). By default CultureInfo.CurrentUiCulture determines the language of the key tip resources. If no resource translation is provided, that corresponds to the current ui culture or the value of the culture parameter, the returned key tip is based on the English resources. |
| GetLargeIcon | Gets a System.Drawing.Bitmap of the large icon that is associated with an item and specified by an identifier or a Scalable Vector Graphics (SVG) stream parameter. The identifier can be the string conversion of an enumeration that is associated with an item (such as RibbonFormattingTab.RibbonItem.TXITEM_Paste). The size of the returned large icon depends on the resolution that is specified by the dpi parameter or the resolution of a specific control. The source of the large image should be based on a grid of 32x32 Pixel and a resolution of 96 dpi. |
| GetSmallIcon | Gets a System.Drawing.Bitmap of the small icon that is associated with an item and specified by an identifier or a Scalable Vector Graphics (SVG) stream parameter. The identifier can be the string conversion of an enumeration that is associated with an item (such as RibbonFormattingTab.RibbonItem.TXITEM_Paste). The size of the returned small icon depends on the resolution that is specified by the dpi parameter or the resolution of a specific control. The source of the small image is based on a grid of 16x16 Pixel and a resolution of 96 dpi. |
| GetText | Gets the text that is associated with an item and specified by the identifier parameter. Such an identifier can be the string conversion of an enumeration that is associated with an item (such as RibbonFormattingTab.RibbonItem.TXITEM_Paste). By default CultureInfo.CurrentUiCulture determines the language of the text resources. If no resource translation is provided, that corresponds to the current ui culture or the value of the culture parameter, the returned text is based on the English resources. |
| GetToolTipDescription | Gets the tool tip description that is associated with an item and specified by the identifier parameter. Such an identifier can be the string conversion of an enumeration that is associated with an item (such as RibbonFormattingTab.RibbonItem.TXITEM_Paste). By default CultureInfo.CurrentUiCulture determines the language of the tool tip description resources. If no resource translation is provided, that corresponds to the current ui culture or the value of the culture parameter, the returned tool tip description is based on the English resources. |
| GetToolTipTitle | Gets the tool tip title that is associated with an item and specified by the identifier parameter. Such an identifier can be the string conversion of an enumeration that is associated with an item (such as RibbonFormattingTab.RibbonItem.TXITEM_Paste). By default CultureInfo.CurrentUiCulture determines the language of the tool tip title. If no resource translation is provided, that corresponds to the current ui culture or the value of the culture parameter, the returned tool tip title is based on the English resources. |
Enumerations
| Enumeration | Description |
|---|---|
| BarcodeItem | Each BarcodeItem represents a drop-down item inside the RibbonInsertTab's TXITEM_Insert_Barcode drop-down menu. The string conversion of each BarcodeItem can be passed as an identifier to static ResourceProvider methods to receive bitmaps or strings that are associated with the corresponding drop-down item. |
| ChartItem | Each ChartItem represents a list view item inside the RibbonInsertTab's TXITEM_InsertChart drop-down menu. The string conversion of each ChartItem can be passed as an identifier to static ResourceProvider methods to receive bitmaps or strings that are associated with the corresponding list view item. |
| FileMenuItem | Each FileMenuItem represents the identifier for a file menu item. The string conversion of each FileMenuItem can be passed as an identifier to static ResourceProvider methods to receive bitmaps or strings that are associated with the corresponding file menu item. |
| GeneralItem | Each GeneralItem represents the identifier for a general item. The string conversion of each GeneralItem can be passed as an identifier to static ResourceProvider methods to receive bitmaps or strings that are associated with the corresponding general item. |
| ShapeItem | Each ShapeItem represents a list view item inside the RibbonInsertTab's TXITEM_InsertShape drop-down menu. The string conversion of each ShapeItem can be passed as an identifier to static ResourceProvider methods to receive bitmaps or strings that are associated with the corresponding list view item. |