Initialize Components - Problem



  • Ich habe in meinem Projekt eine Sprachauswahl mit Sprachdatei eingebaut .
    Wenn mein Programm startet soll es aufgrund eines Registry eintrages entscheiden, welche sprache genutzt werden soll !

    #pragma once
    #include "language.h"
    
    namespace mepla_v4 {
    
    	using namespace System;
    	using namespace System::ComponentModel;
    	using namespace System::Collections;
    	using namespace System::Windows::Forms;
    	using namespace System::Data;
    	using namespace System::Drawing;
    	using namespace Microsoft::Win32;
    
    	/// <summary>
    	/// Zusammenfassung für Form1
    	/// </summary>
    	public ref class Form1 : public System::Windows::Forms::Form
    	{
    	public:
    		Form1(void)
    		{
    
    			InitializeComponent();
    			//
    			//TODO: Konstruktorcode hier hinzufügen.
    			//
    		}
    
    	protected:
    		/// <summary>
    		/// Verwendete Ressourcen bereinigen.
    		/// </summary>
    		~Form1()
    		{
    			if (components)
    			{
    				delete components;
    			}
    		}
    
    	protected: 
    
    	private: System::Windows::Forms::SplitContainer^  main_container;
    
    	private: System::Windows::Forms::Panel^  projekte;
    	private: System::Windows::Forms::Panel^  arbeitsbereiche_panel;
    	private: System::Windows::Forms::GroupBox^  groupBox1;
    	private: System::Windows::Forms::GroupBox^  arbeitsbereiche_group;
    	private: System::Windows::Forms::RadioButton^  optionen_button;
    
    	private: System::Windows::Forms::RadioButton^  lasten_button;
    
    	private: System::Windows::Forms::RadioButton^  lager_button;
    
    	private: System::Windows::Forms::RadioButton^  schichten_button;
    
    	private: System::Windows::Forms::RadioButton^  geometrie_button;
    
    	private: System::Windows::Forms::RadioButton^  projektInfo_button;
    
    	private: System::Windows::Forms::SplitContainer^  arbeitsplatz;
    	private: System::Windows::Forms::SplitContainer^  arbeitsplatz_infos;
    	private: System::Windows::Forms::TreeView^  treeView1;
    	private: System::Windows::Forms::GroupBox^  arbeitsplatz_field;
    	private: System::Windows::Forms::GroupBox^  skizze;
    	private: System::Windows::Forms::GroupBox^  infofeld;
    	private: System::Windows::Forms::RadioButton^  ergebnis_button;
    	private: System::Windows::Forms::MenuStrip^  menuStrip1;
    	private: System::Windows::Forms::ToolStripMenuItem^  dateiToolStripMenuItem;
    	private: System::Windows::Forms::ToolStripMenuItem^  beendenToolStripMenuItem;
    	private: System::Windows::Forms::ToolStripMenuItem^  languageToolStripMenuItem;
    	private: System::Windows::Forms::ToolStripMenuItem^  deutschToolStripMenuItem;
    	private: System::Windows::Forms::ToolStripMenuItem^  englischToolStripMenuItem;
    	private: System::Windows::Forms::Label^  label1;
    
    	private:
    		/// <summary>
    		/// Erforderliche Designervariable.
    		/// </summary>
    		System::ComponentModel::Container ^components;
    
    #pragma region Windows Form Designer generated code
    		/// <summary>
    		/// Erforderliche Methode für die Designerunterstützung.
    		/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
    		/// </summary>
    	protected:void InitializeComponent(void)
    		{
    			this->main_container = (gcnew System::Windows::Forms::SplitContainer());
    			this->projekte = (gcnew System::Windows::Forms::Panel());
    			this->groupBox1 = (gcnew System::Windows::Forms::GroupBox());
    			this->treeView1 = (gcnew System::Windows::Forms::TreeView());
    			this->arbeitsbereiche_panel = (gcnew System::Windows::Forms::Panel());
    			this->arbeitsbereiche_group = (gcnew System::Windows::Forms::GroupBox());
    			this->ergebnis_button = (gcnew System::Windows::Forms::RadioButton());
    			this->optionen_button = (gcnew System::Windows::Forms::RadioButton());
    			this->lasten_button = (gcnew System::Windows::Forms::RadioButton());
    			this->lager_button = (gcnew System::Windows::Forms::RadioButton());
    			this->schichten_button = (gcnew System::Windows::Forms::RadioButton());
    			this->geometrie_button = (gcnew System::Windows::Forms::RadioButton());
    			this->projektInfo_button = (gcnew System::Windows::Forms::RadioButton());
    			this->arbeitsplatz = (gcnew System::Windows::Forms::SplitContainer());
    			this->arbeitsplatz_field = (gcnew System::Windows::Forms::GroupBox());
    			this->label1 = (gcnew System::Windows::Forms::Label());
    			this->arbeitsplatz_infos = (gcnew System::Windows::Forms::SplitContainer());
    			this->skizze = (gcnew System::Windows::Forms::GroupBox());
    			this->infofeld = (gcnew System::Windows::Forms::GroupBox());
    			this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
    			this->dateiToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    			this->beendenToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    			this->languageToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    			this->deutschToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    			this->englischToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
    			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->main_container))->BeginInit();
    			this->main_container->Panel1->SuspendLayout();
    			this->main_container->Panel2->SuspendLayout();
    			this->main_container->SuspendLayout();
    			this->projekte->SuspendLayout();
    			this->groupBox1->SuspendLayout();
    			this->arbeitsbereiche_panel->SuspendLayout();
    			this->arbeitsbereiche_group->SuspendLayout();
    			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->arbeitsplatz))->BeginInit();
    			this->arbeitsplatz->Panel1->SuspendLayout();
    			this->arbeitsplatz->Panel2->SuspendLayout();
    			this->arbeitsplatz->SuspendLayout();
    			this->arbeitsplatz_field->SuspendLayout();
    			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->arbeitsplatz_infos))->BeginInit();
    			this->arbeitsplatz_infos->Panel1->SuspendLayout();
    			this->arbeitsplatz_infos->Panel2->SuspendLayout();
    			this->arbeitsplatz_infos->SuspendLayout();
    			this->menuStrip1->SuspendLayout();
    			this->SuspendLayout();
    			// 
    			// main_container
    			// 
    			this->main_container->Anchor = static_cast<System::Windows::Forms::AnchorStyles>((((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom) 
    				| System::Windows::Forms::AnchorStyles::Left) 
    				| System::Windows::Forms::AnchorStyles::Right));
    			this->main_container->Location = System::Drawing::Point(13, 78);
    			this->main_container->Name = L"main_container";
    			// 
    			// main_container.Panel1
    			// 
    			this->main_container->Panel1->Controls->Add(this->projekte);
    			this->main_container->Panel1->Controls->Add(this->arbeitsbereiche_panel);
    			// 
    			// main_container.Panel2
    			// 
    			this->main_container->Panel2->Controls->Add(this->arbeitsplatz);
    			this->main_container->Size = System::Drawing::Size(1128, 433);
    			this->main_container->SplitterDistance = 257;
    			this->main_container->TabIndex = 1;
    			// 
    			// projekte
    			// 
    			this->projekte->Controls->Add(this->groupBox1);
    			this->projekte->Dock = System::Windows::Forms::DockStyle::Fill;
    			this->projekte->Location = System::Drawing::Point(0, 213);
    			this->projekte->Name = L"projekte";
    			this->projekte->Size = System::Drawing::Size(257, 220);
    			this->projekte->TabIndex = 1;
    			// 
    			// groupBox1
    			// 
    			this->groupBox1->Controls->Add(this->treeView1);
    			this->groupBox1->Dock = System::Windows::Forms::DockStyle::Fill;
    			this->groupBox1->Location = System::Drawing::Point(0, 0);
    			this->groupBox1->Name = L"groupBox1";
    			this->groupBox1->Size = System::Drawing::Size(257, 220);
    			this->groupBox1->TabIndex = 0;
    			this->groupBox1->TabStop = false;
    			this->groupBox1->Text = L"Projekte";
    

    die letzte eigenschaft soll nun geändert werden, undzwar abhängig von dem Registry eintrag ( int ) . Angenommen es soll englsich sein ( "projects" ):

    int lang = Convert::ToInt(Registry::GetValue(path,"lang","0"));
    getLang(lang,1); // getLang(int language, int index); index -> was soll englisch sein ??
    

    also soll aus :

    this->groupBox1->Text = L"Projekte";
    
    //--->
    
    this->groupBox1->Text = getLang(lang,1);
    

    werden... klappt soweit auch nur sobald ich im Ansicht-Designer etwas ändere, wir die gesamte zeile gelöscht .. wie kann ich dieses Überschreiben/Löschen umgehen oder gibt es alternativen ???



  • Der markierte Code

    #pragma region Windows Form Designer generated code
    

    darf nicht von Hand geändert werden!

    Mache deine spezifischen Initialisierungen im Konstruktor (nach dem Aufruf von InitializeComponent();).



  • hm.... ok 🙂


Anmelden zum Antworten