HighTechTalks DotNet Forums  

How do I change/override the following lines of code from the designer?

Dotnet Framework (WinForms DesignTime) microsoft.public.dotnet.framework.windowsforms.designtime


Discuss How do I change/override the following lines of code from the designer? in the Dotnet Framework (WinForms DesignTime) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
schneider
 
Posts: n/a

Default How do I change/override the following lines of code from the designer? - 11-16-2007 , 04:33 PM






How do I change/override the following lines of code from the designer?

Thanks,
Schneider

Designer code below:

public class MyForm : System.Windows.Forms.Form
{
private System.ComponentModel.IContainer components;
private System.Windows.Forms.MonthCalendar m_Calendar;
private System.Windows.Forms.StatusBar statusBar1;
private System.Windows.Forms.Panel panel1;
}



#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.statusBar1 = new System.Windows.Forms.StatusBar();
this.panel1 = new System.Windows.Forms.Panel();

//
// statusBar1 initialize
//


//
// panel1 initialize
//



this.Controls.Add(this.panel1);
this.Controls.Add(this.statusBar1);

}
#endregion

//----------------------------------------------------------

Desired code:

public class MyForm : System.Windows.Forms.Form
{
private m_MyFactory CustFactory = new CustFactory(); //how can I add this?
private System.ComponentModel.IContainer components; //same
private IStatusBar statusBar1; //override the type
private IPanel panel1; //override the type
}



#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();//same
this.statusBar1 = m_MyFactory.CreateStatusBar(); //use factory method
call
this.panel1 = m_MyFactory.CreatePanel(); //use factory method call


//
// statusBar1 initialize
//


//
// panel1 initialize
//



this.Controls.Add((Control)this.panel1); //cast type
this.Controls.Add((Control)this.statusBar1);//cast type

}
#endregion









Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.