473,778 Members | 1,901 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Fliker and UserControl

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

Dec 11 '06 #1
3 2037
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

Dec 11 '06 #2
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
Dec 11 '06 #3
Hi Martin,

You haven't posted enough code for me to reproduce the issue, but you
shouldn't just go ahead and post the rest of it either. You should try to
reduce the problem as much as possible by removing controls and code until
the problem goes away or the UserControl is at its simplest yet, and if you
haven't figured it out by then, post a short but complete sample (see Jon
Skeet's article for guidance:
http://www.yoda.arachsys.com/csharp/complete.html).

In the code you have posted you haven't included some things that may very
well be the cause of your issue. I can't reproduce the following:

1. HandleDestroyed event handler code
2. Load event handler code
3. ddlState custom control
4. ddlCountry custom UserControl
5. ddlCountry.Comb oBoxState = ddlState

In VS 2005, I placed your code in an empty UserControl without the event
handlers and I changed both ddlState and ddlCountry to be normal ComboBox
controls (also removing the assignment of ddlState to the
ddlCountry.Comb oBoxState property). I placed the control on an empty Form
and showed it at the start of the application. The control loaded fine.

To debug this problem, try removing all five of the above points first and
see if the problem goes away, add each back again one at a time until you
can narrow down the problem.

HTH

--
Dave Sexton

"Martin" <ma*********@gm ail.comwrote in message
news:11******** **************@ j72g2000cwa.goo glegroups.com.. .
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.go oglegroups.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

Dec 11 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
1960
by: Raed Sawalha | last post by:
Hi, I have a strange problem with a usercontrol on a page. The usercontrol dispalyes three categories (From a database) when the user clicks a category they see all the products in a shop for that category, the results are paged 10 to a page and the user can page them. As this "Category" usercontrol hardly ever changes I wanted to setup up caching for it. However I realised that when the user clicks a ctageory it is selected and...
2
4633
by: Sascha | last post by:
Hi there, I searched carefully through the web before finally deciding to post this message, because I could not find a solution for my problem. Hopefully someone will have a hint or explanation for me! I apologize for the length of this posting, but I wanted to make sure that I get an answer other than "Hey man, just use LoadControl!", because this is not what I want. The Task: Isolate a collection of web forms which are created as
41
4326
by: JohnR | last post by:
In it's simplest form, assume that I have created a usercontrol, WSToolBarButton that contains a button. I would like to eventually create copies of WSToolBarButton dynamically at run time based on some initialization information obtained elsewhere. Basically, I'm going to create my own dynamic toolbar where the toolbarbuttons can change. I'm not using the VB toolbar because of limitations in changing things like backcolor (I can't get...
12
2212
by: Joe | last post by:
Hello All: Do I have to use the LoadControl method of the Page to load a UserControl? I have a class which contains three methods (one public and two private). The class acts as a control server. It "serves" back the required control (either WebControl or UserControl) based on the contents of an xml file. The code in the webform places each control in a TableCell. My problem is that the control server works as far as returning the...
9
14459
by: Marcelo Cabrera | last post by:
Hi, I have a user control that in turn creates a bunch of webcontrols dynamically and handles the events these webcontrols raise. It used to work fine on ASP .Net 1.1 but when compiled on 2.0 it does not. The problem is that the webcontrols get created on the OnLoad event of the usercontrol and the event handlers are assigned at the same time. I have to click twice on the controls for the events to be raised, the first time nothing...
6
12140
by: MeowCow | last post by:
I have created a UserControl that encapsulates a third party data grid. My goal was to create my own DataSource and DataMember properties that forward the binding to the third party grid, then use binding like normal. The problem I am running into is that my UserControl ends up with a different BindingContext then the ParentForm it is contained in and thus all other controls on the parent form. (I want various controls on the form to...
10
2428
by: Benton | last post by:
Hi there, I have a UserControl with a couple of textboxes and a couple of buttons ("Save" and "Cancel"). The Click event for this buttons is in the UserControl's codebehind of course, so here's my question. Once the UserControl is dropped onto the container page, how can I perform some action on the codebehind of the container page from the codebehind of the UserControl? For instance, suppose that the UserControl is dropped inside one...
0
261
by: Martin | last post by:
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 on the form.
4
2470
by: Martin | last post by:
Hi everyone ! For those who haven't read my previous post, I have a problem with a UserControl. When I try to display it on a form, controls seem to appear one after one. In the following example, it's less visible because controls don't execute any code... Is someone has an idea of how I could solve this problem and also improve the method ShowUserControl. I try to figure out I could flicker effect when I press the button twice quickly.
0
9629
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9470
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10298
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10127
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8957
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5370
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5500
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4033
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.