Hi!
Here some important part of the code in the UserControl... Thanks for
your help ! Maybe it's because I use a TableLayoutPane l ?
public AddressUC()
{
this.SetStyle(
ControlStyles.U serPaint |
ControlStyles.A llPaintingInWmP aint |
ControlStyles.O ptimizedDoubleB uffer, true);
InitializeCompo nent();
}
private void InitializeCompo nent()
{
this.components = new System.Componen tModel.Containe r();
this.tableLayou tPanel1 = new
System.Windows. Forms.TableLayo utPanel();
this.txtStreet = new System.Windows. Forms.TextBox() ;
this.txtCity = new System.Windows. Forms.TextBox() ;
this.ddlState = new
EmpireOne.Clear Sky.Presentatio n.Controls.Comb oBoxState();
this.ddlCountry = new
EmpireOne.Clear Sky.Presentatio n.Controls.Comb oBoxCountry();
this.txtPostalC ode = new System.Windows. Forms.TextBox() ;
this.lblStreet = new System.Windows. Forms.Label();
this.lblCity = new System.Windows. Forms.Label();
this.lblStatePr ovince = new System.Windows. Forms.Label();
this.lblPostalC ode = new System.Windows. Forms.Label();
this.lblCountry = new System.Windows. Forms.Label();
this.errorProvi der = new
System.Windows. Forms.ErrorProv ider(this.compo nents);
this.tableLayou tPanel1.Suspend Layout();
((System.Compon entModel.ISuppo rtInitialize)(t his.errorProvid er)).BeginInit( );
this.SuspendLay out();
//
// tableLayoutPane l1
//
this.tableLayou tPanel1.Anchor =
((System.Window s.Forms.AnchorS tyles)(((System .Windows.Forms. AnchorStyles.To p
| System.Windows. Forms.AnchorSty les.Left)
| System.Windows. Forms.AnchorSty les.Right)));
this.tableLayou tPanel1.ColumnC ount = 2;
this.tableLayou tPanel1.ColumnS tyles.Add(new
System.Windows. Forms.ColumnSty le(System.Windo ws.Forms.SizeTy pe.Absolute,
100F));
this.tableLayou tPanel1.ColumnS tyles.Add(new
System.Windows. Forms.ColumnSty le(System.Windo ws.Forms.SizeTy pe.Percent,
100F));
this.tableLayou tPanel1.ColumnS tyles.Add(new
System.Windows. Forms.ColumnSty le(System.Windo ws.Forms.SizeTy pe.Percent,
100F));
this.tableLayou tPanel1.ColumnS tyles.Add(new
System.Windows. Forms.ColumnSty le(System.Windo ws.Forms.SizeTy pe.Percent,
100F));
this.tableLayou tPanel1.ColumnS tyles.Add(new
System.Windows. Forms.ColumnSty le(System.Windo ws.Forms.SizeTy pe.Percent,
100F));
this.tableLayou tPanel1.ColumnS tyles.Add(new
System.Windows. Forms.ColumnSty le(System.Windo ws.Forms.SizeTy pe.Percent,
100F));
this.tableLayou tPanel1.ColumnS tyles.Add(new
System.Windows. Forms.ColumnSty le(System.Windo ws.Forms.SizeTy pe.Percent,
100F));
this.tableLayou tPanel1.ColumnS tyles.Add(new
System.Windows. Forms.ColumnSty le(System.Windo ws.Forms.SizeTy pe.Percent,
100F));
this.tableLayou tPanel1.ColumnS tyles.Add(new
System.Windows. Forms.ColumnSty le(System.Windo ws.Forms.SizeTy pe.Percent,
100F));
this.tableLayou tPanel1.Control s.Add(this.txtS treet, 1, 2);
this.tableLayou tPanel1.Control s.Add(this.txtC ity, 1, 3);
this.tableLayou tPanel1.Control s.Add(this.ddlS tate, 1, 4);
this.tableLayou tPanel1.Control s.Add(this.ddlC ountry, 1, 1);
this.tableLayou tPanel1.Control s.Add(this.txtP ostalCode, 1,
5);
this.tableLayou tPanel1.Control s.Add(this.lblS treet, 0, 2);
this.tableLayou tPanel1.Control s.Add(this.lblC ity, 0, 3);
this.tableLayou tPanel1.Control s.Add(this.lblS tateProvince,
0, 4);
this.tableLayou tPanel1.Control s.Add(this.lblP ostalCode, 0,
5);
this.tableLayou tPanel1.Control s.Add(this.lblC ountry, 0, 1);
this.tableLayou tPanel1.Locatio n = new
System.Drawing. Point(0, 0);
this.tableLayou tPanel1.Margin = new
System.Windows. Forms.Padding(0 , 3, 0, 3);
this.tableLayou tPanel1.Name = "tableLayoutPan el1";
this.tableLayou tPanel1.RowCoun t = 6;
this.tableLayou tPanel1.RowStyl es.Add(new
System.Windows. Forms.RowStyle( System.Windows. Forms.SizeType. Absolute,
15F));
this.tableLayou tPanel1.RowStyl es.Add(new
System.Windows. Forms.RowStyle( ));
this.tableLayou tPanel1.RowStyl es.Add(new
System.Windows. Forms.RowStyle( ));
this.tableLayou tPanel1.RowStyl es.Add(new
System.Windows. Forms.RowStyle( ));
this.tableLayou tPanel1.RowStyl es.Add(new
System.Windows. Forms.RowStyle( ));
this.tableLayou tPanel1.RowStyl es.Add(new
System.Windows. Forms.RowStyle( ));
this.tableLayou tPanel1.Size = new System.Drawing. Size(618,
165);
this.tableLayou tPanel1.TabInde x = 0;
//
// txtStreet
//
this.txtStreet. Dock = System.Windows. Forms.DockStyle .Fill;
this.errorProvi der.SetIconAlig nment(this.txtS treet,
System.Windows. Forms.ErrorIcon Alignment.Middl eLeft);
this.txtStreet. Location = new System.Drawing. Point(103,
45);
this.txtStreet. MinimumSize = new System.Drawing. Size(4,
26);
this.txtStreet. Multiline = true;
this.txtStreet. Name = "txtStreet" ;
this.txtStreet. ScrollBars =
System.Windows. Forms.ScrollBar s.Vertical;
this.txtStreet. Size = new System.Drawing. Size(512, 32);
this.txtStreet. TabIndex = 1;
//
// txtCity
//
this.txtCity.Do ck = System.Windows. Forms.DockStyle .Fill;
this.errorProvi der.SetIconAlig nment(this.txtC ity,
System.Windows. Forms.ErrorIcon Alignment.Middl eLeft);
this.txtCity.Lo cation = new System.Drawing. Point(103, 83);
this.txtCity.Na me = "txtCity";
this.txtCity.Si ze = new System.Drawing. Size(512, 20);
this.txtCity.Ta bIndex = 2;
//
// ddlState
//
this.ddlState.D ock = System.Windows. Forms.DockStyle .Fill;
this.ddlState.D ropDownStyle =
System.Windows. Forms.ComboBoxS tyle.DropDownLi st;
this.ddlState.F ormattingEnable d = true;
this.errorProvi der.SetIconAlig nment(this.ddlS tate,
System.Windows. Forms.ErrorIcon Alignment.Middl eLeft);
this.ddlState.L ocation = new System.Drawing. Point(103,
109);
this.ddlState.N ame = "ddlState";
this.ddlState.S ize = new System.Drawing. Size(512, 21);
this.ddlState.T abIndex = 3;
//
// ddlCountry
//
this.ddlCountry .ComboBoxState = this.ddlState;
this.ddlCountry .Dock = System.Windows. Forms.DockStyle .Fill;
this.ddlCountry .DropDownStyle =
System.Windows. Forms.ComboBoxS tyle.DropDownLi st;
this.ddlCountry .FormattingEnab led = true;
this.errorProvi der.SetIconAlig nment(this.ddlC ountry,
System.Windows. Forms.ErrorIcon Alignment.Middl eLeft);
this.ddlCountry .Location = new System.Drawing. Point(103,
18);
this.ddlCountry .Name = "ddlCountry ";
this.ddlCountry .Size = new System.Drawing. Size(512, 21);
this.ddlCountry .TabIndex = 0;
//
// txtPostalCode
//
this.txtPostalC ode.Dock =
System.Windows. Forms.DockStyle .Fill;
this.errorProvi der.SetIconAlig nment(this.txtP ostalCode,
System.Windows. Forms.ErrorIcon Alignment.Middl eLeft);
this.txtPostalC ode.Location = new System.Drawing. Point(103,
136);
this.txtPostalC ode.Name = "txtPostalCode" ;
this.txtPostalC ode.Size = new System.Drawing. Size(512, 20);
this.txtPostalC ode.TabIndex = 4;
//
// lblStreet
//
this.lblStreet. AutoSize = true;
this.lblStreet. Dock = System.Windows. Forms.DockStyle .Fill;
this.lblStreet. ImeMode =
System.Windows. Forms.ImeMode.N oControl;
this.lblStreet. Location = new System.Drawing. Point(3, 42);
this.lblStreet. Name = "lblStreet" ;
this.lblStreet. Size = new System.Drawing. Size(94, 38);
this.lblStreet. TabIndex = 0;
this.lblStreet. Text = "lblStreet" ;
this.lblStreet. TextAlign =
System.Drawing. ContentAlignmen t.MiddleLeft;
//
// lblCity
//
this.lblCity.Au toSize = true;
this.lblCity.Do ck = System.Windows. Forms.DockStyle .Fill;
this.lblCity.Im eMode =
System.Windows. Forms.ImeMode.N oControl;
this.lblCity.Lo cation = new System.Drawing. Point(3, 80);
this.lblCity.Na me = "lblCity";
this.lblCity.Si ze = new System.Drawing. Size(94, 26);
this.lblCity.Ta bIndex = 0;
this.lblCity.Te xt = "lblCity";
this.lblCity.Te xtAlign =
System.Drawing. ContentAlignmen t.MiddleLeft;
//
// lblStateProvinc e
//
this.lblStatePr ovince.AutoSize = true;
this.lblStatePr ovince.Dock =
System.Windows. Forms.DockStyle .Fill;
this.lblStatePr ovince.ImeMode =
System.Windows. Forms.ImeMode.N oControl;
this.lblStatePr ovince.Location = new
System.Drawing. Point(3, 106);
this.lblStatePr ovince.Name = "lblStateProvin ce";
this.lblStatePr ovince.Size = new System.Drawing. Size(94,
27);
this.lblStatePr ovince.TabIndex = 0;
this.lblStatePr ovince.Text = "lblStateProvin ce";
this.lblStatePr ovince.TextAlig n =
System.Drawing. ContentAlignmen t.MiddleLeft;
//
// lblPostalCode
//
this.lblPostalC ode.AutoSize = true;
this.lblPostalC ode.Dock =
System.Windows. Forms.DockStyle .Fill;
this.lblPostalC ode.ImeMode =
System.Windows. Forms.ImeMode.N oControl;
this.lblPostalC ode.Location = new System.Drawing. Point(3,
133);
this.lblPostalC ode.Name = "lblPostalCode" ;
this.lblPostalC ode.Size = new System.Drawing. Size(94, 32);
this.lblPostalC ode.TabIndex = 0;
this.lblPostalC ode.Text = "lblPostalCode" ;
this.lblPostalC ode.TextAlign =
System.Drawing. ContentAlignmen t.MiddleLeft;
//
// lblCountry
//
this.lblCountry .AutoSize = true;
this.lblCountry .Dock = System.Windows. Forms.DockStyle .Fill;
this.lblCountry .ImeMode =
System.Windows. Forms.ImeMode.N oControl;
this.lblCountry .Location = new System.Drawing. Point(3, 15);
this.lblCountry .Name = "lblCountry ";
this.lblCountry .Size = new System.Drawing. Size(94, 27);
this.lblCountry .TabIndex = 0;
this.lblCountry .Text = "lblCountry ";
this.lblCountry .TextAlign =
System.Drawing. ContentAlignmen t.MiddleLeft;
//
// errorProvider
//
this.errorProvi der.ContainerCo ntrol = this;
//
// AddressUC
//
this.AutoScaleD imensions = new System.Drawing. SizeF(6F,
13F);
this.AutoScaleM ode =
System.Windows. Forms.AutoScale Mode.Font;
this.Controls.A dd(this.tableLa youtPanel1);
this.DoubleBuff ered = true;
this.Name = "AddressUC" ;
this.Size = new System.Drawing. Size(618, 176);
this.HandleDest royed += new
System.EventHan dler(this.Addre ssUC_HandleDest royed);
this.Load += new System.EventHan dler(this.Addre ssUC_Load);
this.tableLayou tPanel1.ResumeL ayout(false);
this.tableLayou tPanel1.Perform Layout();
((System.Compon entModel.ISuppo rtInitialize)(t his.errorProvid er)).EndInit();
this.ResumeLayo ut(false);
}
Dave Sexton wrote:
Hi Martin,
You might want to post the code for the UserControl instead.
--
Dave Sexton
"Martin" <ma*********@gm ail.comwrote in message
news:11******** **************@ j44g2000cwa.goo glegroups.com.. .
Hi !
I've developed a small UserControl with five textbox and label.
However, when I want to display the UserControl in a form, controls
appear slowly one after one. I've activated double buffering and
removed all code in the OnLoad, constructor and I still have the same
problem.
Here is the code that I use to display the UserControl un the form
_objContainer.S uspendLayout();
_objContainer.C ontrols.Clear() ;
_objContainer.C ontrols.Add(_ob jUserControl);
_objContainer.R esumeLayout(fal se);
How can I resolve this problem? Thanks for your help!
Martin