ComponentResourceManager Class

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Provides simple functionality for enumerating resources for a component or object. The ComponentResourceManager class is a ResourceManager.

Namespace:   System.ComponentModel
Assembly:  System (in System.dll)

System.Object
  System.Resources.ResourceManager
    System.ComponentModel.ComponentResourceManager

<HostProtectionAttribute(SecurityAction.LinkDemand, SharedState := True)>
Public Class ComponentResourceManager
	Inherits ResourceManager

NameDescription
System_CAPS_pubmethodComponentResourceManager()

Initializes a new instance of the ComponentResourceManager class with default values.

System_CAPS_pubmethodComponentResourceManager(Type)

Creates a ComponentResourceManager that looks up resources in satellite assemblies based on information from the specified Type.

NameDescription
System_CAPS_pubpropertyBaseName

Gets the root name of the resource files that the ResourceManager searches for resources.(Inherited from ResourceManager.)

System_CAPS_protpropertyFallbackLocation

Gets or sets the location from which to retrieve default fallback resources.(Inherited from ResourceManager.)

System_CAPS_pubpropertyIgnoreCase

Gets or sets a value that indicates whether the resource manager allows case-insensitive resource lookups in the GetString and GetObject methods.(Inherited from ResourceManager.)

System_CAPS_pubpropertyResourceSetType

Gets the type of the resource set object that the resource manager uses to construct a ResourceSet object.(Inherited from ResourceManager.)

NameDescription
System_CAPS_pubmethodApplyResources(Object, String)

Applies a resource's value to the corresponding property of the object.

System_CAPS_pubmethodApplyResources(Object, String, CultureInfo)

Applies a resource's value to the corresponding property of the object.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetObject(String)

Returns the value of the specified non-string resource.(Inherited from ResourceManager.)

System_CAPS_pubmethodGetObject(String, CultureInfo)

Gets the value of the specified non-string resource localized for the specified culture.(Inherited from ResourceManager.)

System_CAPS_protmethodGetResourceFileName(CultureInfo)

Generates the name of the resource file for the given CultureInfo object.(Inherited from ResourceManager.)

System_CAPS_pubmethodGetResourceSet(CultureInfo, Boolean, Boolean)

Retrieves the resource set for a particular culture.(Inherited from ResourceManager.)

System_CAPS_pubmethodGetStream(String)

Returns an unmanaged memory stream object from the specified resource.(Inherited from ResourceManager.)

System_CAPS_pubmethodGetStream(String, CultureInfo)

Returns an unmanaged memory stream object from the specified resource, using the specified culture.(Inherited from ResourceManager.)

System_CAPS_pubmethodGetString(String)

Returns the value of the specified string resource.(Inherited from ResourceManager.)

System_CAPS_pubmethodGetString(String, CultureInfo)

Returns the value of the string resource localized for the specified culture.(Inherited from ResourceManager.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodInternalGetResourceSet(CultureInfo, Boolean, Boolean)

Provides the implementation for finding a resource set.(Inherited from ResourceManager.)

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_pubmethodReleaseAllResources()

Tells the resource manager to call the Close method on all ResourceSet objects and release all resources.(Inherited from ResourceManager.)

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

NameDescription
System_CAPS_protfieldBaseNameField

Specifies the root name of the resource files that the ResourceManager searches for resources.(Inherited from ResourceManager.)

System_CAPS_protfieldMainAssembly

Specifies the main assembly that contains the resources.(Inherited from ResourceManager.)

System_CAPS_protfieldResourceSets

Obsolete. Contains a Hashtable that returns a mapping from cultures to ResourceSet objects.(Inherited from ResourceManager.)

The following code example demonstrates how to use ComponentResourceManager to assign image resources to the Image property of ToolStripButton controls.

Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms

Public Class Form1
   Inherits Form
   Private toolStripButton1 As ToolStripButton
   Private toolStripButton2 As ToolStripButton
   Private toolStripButton3 As ToolStripButton
   Private contextMenuStrip1 As ContextMenuStrip
   Private components As IContainer
   Private toolStripMenuItem1 As ToolStripMenuItem
   Private toolStripMenuItem2 As ToolStripMenuItem
   Private contextMenuStrip2 As ContextMenuStrip
   Private rearrangeButtonsToolStripMenuItem As ToolStripMenuItem
   Private selectIconsToolStripMenuItem As ToolStripMenuItem
   Private toolStrip1 As ToolStrip


   Public Sub New()
        InitializeComponent()
    End Sub

    <STAThread()> _
    Public Sub Main()
        Application.EnableVisualStyles()
        Application.Run(New Form1())
    End Sub

    Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container()
        Dim resources As New System.ComponentModel.ComponentResourceManager(GetType(Form1))
        Me.toolStrip1 = New System.Windows.Forms.ToolStrip()
        Me.toolStripButton1 = New System.Windows.Forms.ToolStripButton()
        Me.toolStripButton2 = New System.Windows.Forms.ToolStripButton()
        Me.toolStripButton3 = New System.Windows.Forms.ToolStripButton()
        Me.contextMenuStrip1 = New System.Windows.Forms.ContextMenuStrip(Me.components)
        Me.contextMenuStrip2 = New System.Windows.Forms.ContextMenuStrip(Me.components)
        Me.toolStripMenuItem1 = New System.Windows.Forms.ToolStripMenuItem()
        Me.toolStripMenuItem2 = New System.Windows.Forms.ToolStripMenuItem()
        Me.rearrangeButtonsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
        Me.selectIconsToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
        Me.toolStrip1.SuspendLayout()
        Me.contextMenuStrip1.SuspendLayout()
        Me.contextMenuStrip2.SuspendLayout()
        Me.SuspendLayout()
        '
        ' Associate contextMenuStrip2 with toolStrip1.
        ' toolStrip1 property settings follow.
        '
        Me.toolStrip1.ContextMenuStrip = Me.contextMenuStrip2
        Me.toolStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.toolStripButton1, Me.toolStripButton2, Me.toolStripButton3})
        Me.toolStrip1.Location = New System.Drawing.Point(0, 0)
        Me.toolStrip1.Name = "toolStrip1"
        Me.toolStrip1.Size = New System.Drawing.Size(292, 25)
        Me.toolStrip1.TabIndex = 0
        Me.toolStrip1.Text = "toolStrip1"
        ' 
        ' toolStripButton1
        ' 
        Me.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
        Me.toolStripButton1.Image = CType(resources.GetObject("toolStripButton1.Image"), System.Drawing.Image)
        Me.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta
        Me.toolStripButton1.Name = "toolStripButton1"
        Me.toolStripButton1.Text = "toolStripButton1"
        ' 
        ' toolStripButton2
        ' 
        Me.toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
        Me.toolStripButton2.Image = CType(resources.GetObject("toolStripButton2.Image"), System.Drawing.Image)
        Me.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta
        Me.toolStripButton2.Name = "toolStripButton2"
        Me.toolStripButton2.Text = "toolStripButton2"
        ' 
        ' toolStripButton3
        ' 
        Me.toolStripButton3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
        Me.toolStripButton3.Image = CType(resources.GetObject("toolStripButton3.Image"), System.Drawing.Image)
        Me.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta
        Me.toolStripButton3.Name = "toolStripButton3"
        Me.toolStripButton3.Text = "toolStripButton3"
        ' 
        ' contextMenuStrip1
        ' 
        Me.contextMenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.toolStripMenuItem1, Me.toolStripMenuItem2})
        Me.contextMenuStrip1.Name = "contextMenuStrip1"
        Me.contextMenuStrip1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.contextMenuStrip1.Size = New System.Drawing.Size(131, 48)
        ' 
        ' contextMenuStrip2
        ' 
        Me.contextMenuStrip2.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.rearrangeButtonsToolStripMenuItem, Me.selectIconsToolStripMenuItem})
        Me.contextMenuStrip2.Name = "contextMenuStrip2"
        Me.contextMenuStrip2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.contextMenuStrip2.Size = New System.Drawing.Size(162, 48)
        ' 
        ' toolStripMenuItem1
        ' 
        Me.toolStripMenuItem1.Name = "toolStripMenuItem1"
        Me.toolStripMenuItem1.Text = "&Resize"
        ' 
        ' toolStripMenuItem2
        ' 
        Me.toolStripMenuItem2.Name = "toolStripMenuItem2"
        Me.toolStripMenuItem2.Text = "&Keep on Top"
        ' 
        ' rearrangeButtonsToolStripMenuItem
        ' 
        Me.rearrangeButtonsToolStripMenuItem.Name = "rearrangeButtonsToolStripMenuItem"
        Me.rearrangeButtonsToolStripMenuItem.Text = "R&earrange Buttons"
        ' 
        ' selectIconsToolStripMenuItem
        ' 
        Me.selectIconsToolStripMenuItem.Name = "selectIconsToolStripMenuItem"
        Me.selectIconsToolStripMenuItem.Text = "&Select Icons"
        ' 
        ' Associate contextMenuStrip1 with Form1.
        ' Form1 property settings follow.
        '
        Me.ClientSize = New System.Drawing.Size(292, 266)
        Me.ContextMenuStrip = Me.contextMenuStrip1
        Me.Controls.Add(toolStrip1)
        Me.Name = "Form1"
        Me.toolStrip1.ResumeLayout(False)
        Me.contextMenuStrip1.ResumeLayout(False)
        Me.contextMenuStrip2.ResumeLayout(False)
        Me.ResumeLayout(False)
        Me.PerformLayout()
    End Sub

.NET Framework
Available since 1.1

Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: