Public Sub SetMenuStripTexts(ByVal itm As ToolStripMenuItem, ByVal trans As System.ComponentModel.ComponentResourceManager)
If TypeOf itm Is ToolStripItem Then 'Testen, ob auch ein Toolstrip/*Menu*/Item vorliegt
With DirectCast(itm, ToolStripMenuItem)
For Each itmRecurse As ToolStripItem In .DropDownItems
trans.ApplyResources(itmRecurse, itmRecurse.Name)
SetMenuStripTexts(itmRecurse, trans)
Next
End With
End If
End Sub
Public Sub formneuzeichnen()
'Nach allen geöffneten Formen suchen
For Each Frm As System.Windows.Forms.Form In System.Windows.Forms.Application.OpenForms
'anlegen eines Component ResourcenManager
trans = New System.ComponentModel.ComponentResourceManager(Frm.GetType)
'Position der Form speichern
Dim ptlocation As Point = Frm.Location
'Resourcen übernehmen
trans.ApplyResources(Frm, Frm.Name.ToString)
'Position setzen
Frm.Location = ptlocation
'Resourcen für alle Controlls übernehmen
For Each thiscontrol As System.Windows.Forms.Control In Frm.Controls
trans.ApplyResources(thiscontrol, thiscontrol.Name)
If thiscontrol.HasChildren Then
For Each thisctr As Control In thiscontrol.Controls
trans.ApplyResources(thisctr, thisctr.Name)
Next thisctr
End If
Next thiscontrol
Next
For Each Frm As System.Windows.Forms.Form In System.Windows.Forms.Application.OpenForms
If Frm.MainMenuStrip IsNot Nothing Then
'Menübeschriftung
For Each itm As System.Windows.Forms.ToolStripMenuItem In Frm.MainMenuStrip.Items
Call SetMenuStripTexts(itm, trans)
Next
Else
'Throw New Exception(String.Concat("""", Frm.Name, """hat gar kein Menü!"))
End If
Next
End Sub