How to write properties in design time
-
Hi all I have an inherited control from standard textbox control. In this textbox control i set some default property value to new one.
//Suppose i want what derived control has by default BackColor = Red; this.BackColor = System.Drawing.Color.Red;
In this case when user place my derived control to a form designer generate in InitializeComponent() this rows((System.ComponentModel.ISupportInitialize)(this.derivedTextBox)).BeginInit(); .... this.derivedTextBox.BackColor = System.Drawing.Color.Red;
As a result when form are created DerivedTextBox.BackColor property invoked 2 times. First - when control created and Second - in the InitializeComponent() method of form where placed. I know that in this example it dosn't matter but actually i have other base control (not text box), what can add to oneself buttons [for examp: this.Buttons.Add("MyNewButton") - base control by default not have this button, but in derived it shoul be], and since what every time when i want to add button to this control one add two times) And now i have question, is exists an event what invoked only when control added to a form??? Or where in code i should write initialization control code so as this code will only generated in InitializeComponent() method of form and not to bee invoked when control are created???? THANK. -
Hi all I have an inherited control from standard textbox control. In this textbox control i set some default property value to new one.
//Suppose i want what derived control has by default BackColor = Red; this.BackColor = System.Drawing.Color.Red;
In this case when user place my derived control to a form designer generate in InitializeComponent() this rows((System.ComponentModel.ISupportInitialize)(this.derivedTextBox)).BeginInit(); .... this.derivedTextBox.BackColor = System.Drawing.Color.Red;
As a result when form are created DerivedTextBox.BackColor property invoked 2 times. First - when control created and Second - in the InitializeComponent() method of form where placed. I know that in this example it dosn't matter but actually i have other base control (not text box), what can add to oneself buttons [for examp: this.Buttons.Add("MyNewButton") - base control by default not have this button, but in derived it shoul be], and since what every time when i want to add button to this control one add two times) And now i have question, is exists an event what invoked only when control added to a form??? Or where in code i should write initialization control code so as this code will only generated in InitializeComponent() method of form and not to bee invoked when control are created???? THANK.if you have a constructor in your derived class then inherit the base class constructor, like:
MyTextBox(): base()
{}
i think you should use ControlAdded Event
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y -------------------------------------------------------- 128 bit encrypted signature, crack if you can