Click here to Skip to main content
15,892,839 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a class inherited from a control
I set some properties that i want in inherited class
i drag my custom control in the from then change some properties. but when i rebuild it, changes in designer is disappeared and again is like base control.
This is my code, i want to change the ValueType in designer to decimal.
Thanks.

C#
public class NumericEditBoxBase : NumericEditBox
   {
       public NumericEditBoxBase()
       {
           InitializeComponent();
       }
       private void InitializeComponent()
       {
           this.SuspendLayout();
           this.VisualStyle = Janus.Windows.GridEX.VisualStyle.Office2010;
           this.OfficeColorScheme = Janus.Windows.GridEX.OfficeColorScheme.Custom;
           this.ValueType = Janus.Windows.GridEX.NumericEditValueType.Int64;
           this.TextAlignment = Janus.Windows.GridEX.TextAlignment.Center;

           this.Enter += new System.EventHandler(this.NumericEditBoxBase_Enter);
           this.Leave += new System.EventHandler(this.NumericEditBoxBase_Leave);


           this.ResumeLayout(false);

       }

       private void NumericEditBoxBase_Enter(object sender, EventArgs e)
       {
           this.OfficeCustomColor = Color.Black;
           this.BackColor = Color.DimGray;
           this.ForeColor = Color.FromKnownColor(KnownColor.Window);
       }

       private void NumericEditBoxBase_Leave(object sender, EventArgs e)
       {
           this.OfficeCustomColor = Color.DimGray;
           this.BackColor = Color.FromKnownColor(KnownColor.Window);
           this.ForeColor = Color.FromKnownColor(KnownColor.WindowText);
       }
   }
Posted

1 solution

Hi This will be reinitialized by the Visual Studio .NET Designer. You may need to work with System.ComponentModel.Design.Serialization.CodeDomSerializer.

Please refer
HTML

[^]

Regards
Dominic
 
Share this answer
 
Comments
Hamid Noahdi 16-Nov-12 4:31am    
Thanks, but i'm confused , could you please help me what should i add to code above in order to:
when i drag my costume component on the form it get initialized but when i change the property, after rebuilding project it still have the changed property.
Thanks again

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900