TX Text Control .NET for Windows Forms

ResourceProvider Class

Class|Introduced in 27.0
Namespace
TXTextControl.Windows.Forms
Package
TXTextControl.TextControl.WinForms.SDK from the private NuGet feed or Text Control Offline Packages
Assembly
TXTextControl.Windows.Forms.dll
Install
dotnet add package TXTextControl.TextControl.WinForms.SDK .NET 8 and later. For .NET Framework, reference TXTextControl.Windows.Forms.dll from the setup.

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 ResourceProvider

Examples

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);

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.");

Members

Methods

MethodDescription
GetKeyTipGets 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.
GetLargeIconGets 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.
GetSmallIconGets 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.
GetTextGets 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.
GetToolTipDescriptionGets 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.
GetToolTipTitleGets 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

EnumerationDescription
BarcodeItemEach 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.
ChartItemEach 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.
FileMenuItemEach 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.
GeneralItemEach 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.
ShapeItemEach 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.

Further Reading

  • Using the ResourceProvider to Customize the Ribbon MiniToolbar –
  • X17: Using the Windows Forms Resource Provider –