本文整理汇总了VB.NET中System.Resources.ResXResourceSet类的典型用法代码示例。如果您正苦于以下问题:VB.NET ResXResourceSet类的具体用法?VB.NET ResXResourceSet怎么用?VB.NET ResXResourceSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ResXResourceSet类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: Example
' 导入命名空间
Imports System.Collections
Imports System.Drawing
Imports System.Resources
Module Example
Public Sub Main()
CreateResXFile()
Dim resSet As New ResXResourceSet(".\StoreResources.resx")
Dim dict As IDictionaryEnumerator = resSet.GetEnumerator()
Do While dict.MoveNext()
Dim key As String = CStr(dict.Key)
' Retrieve resource by name.
If typeof dict.Value Is String Then
Console.WriteLine("{0}: {1}", key, resSet.GetString(key))
Else
Console.WriteLine("{0}: {1}", key, resSet.GetObject(key))
End If
Loop
End Sub
Private Sub CreateResXFile()
Dim logo As New Bitmap(".\Logo.bmp")
Dim node As ResXDataNode
Dim rw As New ResXResourceWriter(".\StoreResources.resx")
node = New ResXDataNode("Logo", logo)
node.Comment = "The corporate logo."
rw.AddResource(node)
rw.AddResource("AppTitle", "Store Locations")
node = New ResXDataNode("nColumns", 5)
node.Comment = "The number of columns in the Store Location table"
rw.AddResource(node)
rw.AddResource("City", "City")
rw.AddResource("State", "State")
rw.AddResource("Code", "Zip Code")
rw.AddResource("Telephone", "Phone")
rw.Generate()
rw.Close()
End Sub
End Module
输出:
Telephone: Phone Code: Zip Code State: State City: City nColumns: 5 AppTitle: Store Locations Logo: System.Drawing.Bitmap