... / 2 neue Fragen



  • Ich habe gerade ein Control geschrieben, das beim Focus und Unfocus die Farbe ändern soll, aber leider bleibt die Farbe nach dem Setzen von this->BackColor gleich...

    Was mache ich falsch?



  • #pragma once
    
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;
    
    namespace test {
    
    	public ref class testControl : public System::Windows::Forms::UserControl
    	{
    	public:
    		testControl(void)
    		{InitializeComponent();	}
    
    	protected:
    		~testControl()
    		{
    			if (components)
    			{
    				delete components;
    			}
    		}
    
    	private:
    		System::ComponentModel::Container^ components;
    
    #pragma region Windows Form Designer generated code
    		void InitializeComponent(void)
    		{
    			this->SuspendLayout();
    			// 
    			// testControl
    			// 
    			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
    			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
    			this->Name = L"testControl";
    			this->Leave += gcnew System::EventHandler(this, &testControl::testControl_Leave);
    			this->ResumeLayout(false);
    
    		}
    #pragma endregion
    
    	private: System::Void testControl_Leave(System::Object^  sender, System::EventArgs^  e) 
    			 {
    				 this->BackColor = Color::Red;
    			 }
    	};
    }
    

    Geht ohne Probleme



  • Bei mir funktionierts jetzt auch.

    Jetzt habe ich allerdings 2 neue Fragen:

    1. Ich hab mein Control in ein FlowControlPanel eingefügt und es dauert auch ziemlich lange zu scrollen und upzudaten, kann ich mein Control auch schneller machen?
    2. Wie kann ich mein Control zu den Toolbox Items hinzufügen, also mit Bild, beschreibung und Name?


Anmelden zum Antworten