473,387 Members | 1,481 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

UserControl and Fliker - Take 2

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.

Thanks for your help !

----- Form1.cs -----
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication2
{
public class Form1 : Form
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be
disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#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.splitContainer1 = new
System.Windows.Forms.SplitContainer();
this.button1 = new System.Windows.Forms.Button();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock =
System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0,
0);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.butt on1);
this.splitContainer1.Size = new System.Drawing.Size(642,
305);
this.splitContainer1.SplitterDistance = 425;
this.splitContainer1.TabIndex = 0;
//
// button1
//
this.button1.Location = new System.Drawing.Point(21, 22);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new
System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F,
13F);
this.AutoScaleMode =
System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(642, 305);
this.Controls.Add(this.splitContainer1);
this.Name = "Form1";
this.Text = "Form1";
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Button button1;
public Form1()
{
InitializeComponent();
}

private void ShowUserControl(UserControl _objUserControl,
Control _objContainer)
{
_objUserControl.Location = new Point(0, 0);
_objUserControl.Size =
new Size(_objContainer.Width, _objContainer.Height);
_objUserControl.Anchor = AnchorStyles.Top |
AnchorStyles.Bottom |
AnchorStyles.Left |
AnchorStyles.Right;

_objContainer.SuspendLayout();

_objContainer.Controls.Clear();
_objContainer.Controls.Add(_objUserControl);

_objContainer.ResumeLayout();
}

private void button1_Click(object sender, EventArgs e)
{
ShowUserControl(new UserControl1(),
splitContainer1.Panel1);
}
}
}

---- UserControl1.cs ----
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication2
{
public class UserControl1 : UserControl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be
disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Component 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.tableLayoutPanel = new
System.Windows.Forms.TableLayoutPanel();
this.txtStreet = new System.Windows.Forms.TextBox();
this.txtCity = new System.Windows.Forms.TextBox();
this.ddlState = new System.Windows.Forms.ComboBox();
this.ddlCountry = new System.Windows.Forms.ComboBox();
this.txtPostalCode = new System.Windows.Forms.TextBox();
this.lblStreet = new System.Windows.Forms.Label();
this.lblCity = new System.Windows.Forms.Label();
this.lblStateProvince = new System.Windows.Forms.Label();
this.lblPostalCode = new System.Windows.Forms.Label();
this.lblCountry = new System.Windows.Forms.Label();
this.errorProvider = new
System.Windows.Forms.ErrorProvider(this.components );
this.tableLayoutPanel.SuspendLayout();

((System.ComponentModel.ISupportInitialize)(this.e rrorProvider)).BeginInit();
this.SuspendLayout();
//
// tableLayoutPanel1
//
this.tableLayoutPanel.Anchor =
((System.Windows.Forms.AnchorStyles)(((System.Wind ows.Forms.AnchorStyles.Top
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel.ColumnCount = 2;
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Absolute,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.Controls.Add(this.txtStreet, 1, 2);
this.tableLayoutPanel.Controls.Add(this.txtCity, 1, 3);
this.tableLayoutPanel.Controls.Add(this.ddlState, 1, 4);
this.tableLayoutPanel.Controls.Add(this.ddlCountry , 1, 1);
this.tableLayoutPanel.Controls.Add(this.txtPostalC ode, 1,
5);
this.tableLayoutPanel.Controls.Add(this.lblStreet, 0, 2);
this.tableLayoutPanel.Controls.Add(this.lblCity, 0, 3);
this.tableLayoutPanel.Controls.Add(this.lblStatePr ovince,
0, 4);
this.tableLayoutPanel.Controls.Add(this.lblPostalC ode, 0,
5);
this.tableLayoutPanel.Controls.Add(this.lblCountry , 0, 1);
this.tableLayoutPanel.Location = new
System.Drawing.Point(0, 0);
this.tableLayoutPanel.Margin = new
System.Windows.Forms.Padding(0, 3, 0, 3);
this.tableLayoutPanel.Name = "tableLayoutPanel";
this.tableLayoutPanel.RowCount = 6;
this.tableLayoutPanel.RowStyles.Add(new
System.Windows.Forms.RowStyle(System.Windows.Forms .SizeType.Absolute,
15F));
this.tableLayoutPanel.RowStyles.Add(new
System.Windows.Forms.RowStyle());
this.tableLayoutPanel.RowStyles.Add(new
System.Windows.Forms.RowStyle());
this.tableLayoutPanel.RowStyles.Add(new
System.Windows.Forms.RowStyle());
this.tableLayoutPanel.RowStyles.Add(new
System.Windows.Forms.RowStyle());
this.tableLayoutPanel.RowStyles.Add(new
System.Windows.Forms.RowStyle());
this.tableLayoutPanel.Size = new System.Drawing.Size(618,
165);
this.tableLayoutPanel.TabIndex = 0;
//
// txtStreet
//
this.txtStreet.Dock = System.Windows.Forms.DockStyle.Fill;
this.errorProvider.SetIconAlignment(this.txtStreet ,
System.Windows.Forms.ErrorIconAlignment.MiddleLeft );
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.ScrollBars.Vertical;
this.txtStreet.Size = new System.Drawing.Size(512, 32);
this.txtStreet.TabIndex = 1;
//
// txtCity
//
this.txtCity.Dock = System.Windows.Forms.DockStyle.Fill;
this.errorProvider.SetIconAlignment(this.txtCity,
System.Windows.Forms.ErrorIconAlignment.MiddleLeft );
this.txtCity.Location = new System.Drawing.Point(103, 83);
this.txtCity.Name = "txtCity";
this.txtCity.Size = new System.Drawing.Size(512, 20);
this.txtCity.TabIndex = 2;
//
// ddlState
//
this.ddlState.Dock = System.Windows.Forms.DockStyle.Fill;
this.ddlState.DropDownStyle =
System.Windows.Forms.ComboBoxStyle.DropDownList;
this.ddlState.FormattingEnabled = true;
this.errorProvider.SetIconAlignment(this.ddlState,
System.Windows.Forms.ErrorIconAlignment.MiddleLeft );
this.ddlState.Location = new System.Drawing.Point(103,
109);
this.ddlState.Name = "ddlState";
this.ddlState.Size = new System.Drawing.Size(512, 21);
this.ddlState.TabIndex = 3;
//
// ddlCountry
//
this.ddlCountry.Dock = System.Windows.Forms.DockStyle.Fill;
this.ddlCountry.DropDownStyle =
System.Windows.Forms.ComboBoxStyle.DropDownList;
this.ddlCountry.FormattingEnabled = true;
this.errorProvider.SetIconAlignment(this.ddlCountr y,
System.Windows.Forms.ErrorIconAlignment.MiddleLeft );
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.txtPostalCode.Dock =
System.Windows.Forms.DockStyle.Fill;
this.errorProvider.SetIconAlignment(this.txtPostal Code,
System.Windows.Forms.ErrorIconAlignment.MiddleLeft );
this.txtPostalCode.Location = new System.Drawing.Point(103,
136);
this.txtPostalCode.Name = "txtPostalCode";
this.txtPostalCode.Size = new System.Drawing.Size(512, 20);
this.txtPostalCode.TabIndex = 4;
//
// lblStreet
//
this.lblStreet.AutoSize = true;
this.lblStreet.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblStreet.ImeMode =
System.Windows.Forms.ImeMode.NoControl;
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.ContentAlignment.MiddleLeft;
//
// lblCity
//
this.lblCity.AutoSize = true;
this.lblCity.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblCity.ImeMode =
System.Windows.Forms.ImeMode.NoControl;
this.lblCity.Location = new System.Drawing.Point(3, 80);
this.lblCity.Name = "lblCity";
this.lblCity.Size = new System.Drawing.Size(94, 26);
this.lblCity.TabIndex = 0;
this.lblCity.Text = "lblCity";
this.lblCity.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;
//
// lblStateProvince
//
this.lblStateProvince.AutoSize = true;
this.lblStateProvince.Dock =
System.Windows.Forms.DockStyle.Fill;
this.lblStateProvince.ImeMode =
System.Windows.Forms.ImeMode.NoControl;
this.lblStateProvince.Location = new
System.Drawing.Point(3, 106);
this.lblStateProvince.Name = "lblStateProvince";
this.lblStateProvince.Size = new System.Drawing.Size(94,
27);
this.lblStateProvince.TabIndex = 0;
this.lblStateProvince.Text = "lblStateProvince";
this.lblStateProvince.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;
//
// lblPostalCode
//
this.lblPostalCode.AutoSize = true;
this.lblPostalCode.Dock =
System.Windows.Forms.DockStyle.Fill;
this.lblPostalCode.ImeMode =
System.Windows.Forms.ImeMode.NoControl;
this.lblPostalCode.Location = new System.Drawing.Point(3,
133);
this.lblPostalCode.Name = "lblPostalCode";
this.lblPostalCode.Size = new System.Drawing.Size(94, 32);
this.lblPostalCode.TabIndex = 0;
this.lblPostalCode.Text = "lblPostalCode";
this.lblPostalCode.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;
//
// lblCountry
//
this.lblCountry.AutoSize = true;
this.lblCountry.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblCountry.ImeMode =
System.Windows.Forms.ImeMode.NoControl;
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.ContentAlignment.MiddleLeft;
//
// errorProvider
//
this.errorProvider.ContainerControl = this;
//
// AddressUC
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F,
13F);
this.AutoScaleMode =
System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.tableLayoutPanel);
this.DoubleBuffered = true;
this.Name = "AddressUC";
this.Size = new System.Drawing.Size(618, 176);
this.tableLayoutPanel.ResumeLayout(false);
this.tableLayoutPanel.PerformLayout();

((System.ComponentModel.ISupportInitialize)(this.e rrorProvider)).EndInit();
this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.TableLayoutPanel tableLayoutPanel;
private System.Windows.Forms.TextBox txtStreet;
private System.Windows.Forms.TextBox txtCity;
private System.Windows.Forms.ComboBox ddlState;
private System.Windows.Forms.ComboBox ddlCountry;
private System.Windows.Forms.TextBox txtPostalCode;
private System.Windows.Forms.Label lblStreet;
private System.Windows.Forms.Label lblCity;
private System.Windows.Forms.Label lblStateProvince;
private System.Windows.Forms.Label lblPostalCode;
private System.Windows.Forms.Label lblCountry;
private System.Windows.Forms.ErrorProvider errorProvider;

public UserControl1()
{
InitializeComponent();
}
}
}

Dec 12 '06 #1
4 2449

Martin wrote:
In the following example, it's less visible
because controls don't execute any code...
I assume you mean "code in their constructors". What code are you
executing in the controls' constructors? You should do the minimum
amount of work in constructors and do as much of the heavy lifting as
you can when the control is loaded.

Dec 12 '06 #2
Hi Bruce,

It's exactly what I mean... Controls don't have any code in their
constructor, OnLoad, etc. Usually, the Country ComboBox load from a SQL
Server Database a list of Countries. The same for the State ComboBox,
but it waits for the Country ComboBox to load its list of state. These
operations are fast...

In my case, controls come out in the following order : txtStreet,
txtCity, txtPostalCode, ddlCountry and ddlState...

Thanks

Bruce Wood wrote:
Martin wrote:
In the following example, it's less visible
because controls don't execute any code...

I assume you mean "code in their constructors". What code are you
executing in the controls' constructors? You should do the minimum
amount of work in constructors and do as much of the heavy lifting as
you can when the control is loaded.
Dec 12 '06 #3
Hi Martin,

Well this time I was able to build the solution :)

I think I see the flicker you're referring to, but it's awfully fast on my
computer. TableLayoutPanel is usually the problem, although it still
renders quickly for such a small control.

It sounds to me like it might be your data-access code that is the bottle
neck (you mentioned it in another post in this thread). If so you might
want to use asynchronous calls to the database or use a BackgroundWorker
component to free up the UI thread while it's loading.

Actually, a better question would be, how much flicker is there? What
exactly do you mean by "appear one after one"? Is it painfully obvious or
is it so quick that it's easy to miss (as in my testing)?

To be perfectly honest, if it's really fast then I don't think that there's
anything you can do about it. That's the price you pay when using Controls
to ease development.

--
Dave Sexton

"Martin" <ma*********@gmail.comwrote in message
news:11**********************@j72g2000cwa.googlegr oups.com...
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.

Thanks for your help !

----- Form1.cs -----
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication2
{
public class Form1 : Form
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be
disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#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.splitContainer1 = new
System.Windows.Forms.SplitContainer();
this.button1 = new System.Windows.Forms.Button();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock =
System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0,
0);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.butt on1);
this.splitContainer1.Size = new System.Drawing.Size(642,
305);
this.splitContainer1.SplitterDistance = 425;
this.splitContainer1.TabIndex = 0;
//
// button1
//
this.button1.Location = new System.Drawing.Point(21, 22);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new
System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F,
13F);
this.AutoScaleMode =
System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(642, 305);
this.Controls.Add(this.splitContainer1);
this.Name = "Form1";
this.Text = "Form1";
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Button button1;
public Form1()
{
InitializeComponent();
}

private void ShowUserControl(UserControl _objUserControl,
Control _objContainer)
{
_objUserControl.Location = new Point(0, 0);
_objUserControl.Size =
new Size(_objContainer.Width, _objContainer.Height);
_objUserControl.Anchor = AnchorStyles.Top |
AnchorStyles.Bottom |
AnchorStyles.Left |
AnchorStyles.Right;

_objContainer.SuspendLayout();

_objContainer.Controls.Clear();
_objContainer.Controls.Add(_objUserControl);

_objContainer.ResumeLayout();
}

private void button1_Click(object sender, EventArgs e)
{
ShowUserControl(new UserControl1(),
splitContainer1.Panel1);
}
}
}

---- UserControl1.cs ----
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication2
{
public class UserControl1 : UserControl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be
disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Component 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.tableLayoutPanel = new
System.Windows.Forms.TableLayoutPanel();
this.txtStreet = new System.Windows.Forms.TextBox();
this.txtCity = new System.Windows.Forms.TextBox();
this.ddlState = new System.Windows.Forms.ComboBox();
this.ddlCountry = new System.Windows.Forms.ComboBox();
this.txtPostalCode = new System.Windows.Forms.TextBox();
this.lblStreet = new System.Windows.Forms.Label();
this.lblCity = new System.Windows.Forms.Label();
this.lblStateProvince = new System.Windows.Forms.Label();
this.lblPostalCode = new System.Windows.Forms.Label();
this.lblCountry = new System.Windows.Forms.Label();
this.errorProvider = new
System.Windows.Forms.ErrorProvider(this.components );
this.tableLayoutPanel.SuspendLayout();

((System.ComponentModel.ISupportInitialize)(this.e rrorProvider)).BeginInit();
this.SuspendLayout();
//
// tableLayoutPanel1
//
this.tableLayoutPanel.Anchor =
((System.Windows.Forms.AnchorStyles)(((System.Wind ows.Forms.AnchorStyles.Top
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel.ColumnCount = 2;
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Absolute,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.Controls.Add(this.txtStreet, 1, 2);
this.tableLayoutPanel.Controls.Add(this.txtCity, 1, 3);
this.tableLayoutPanel.Controls.Add(this.ddlState, 1, 4);
this.tableLayoutPanel.Controls.Add(this.ddlCountry , 1, 1);
this.tableLayoutPanel.Controls.Add(this.txtPostalC ode, 1,
5);
this.tableLayoutPanel.Controls.Add(this.lblStreet, 0, 2);
this.tableLayoutPanel.Controls.Add(this.lblCity, 0, 3);
this.tableLayoutPanel.Controls.Add(this.lblStatePr ovince,
0, 4);
this.tableLayoutPanel.Controls.Add(this.lblPostalC ode, 0,
5);
this.tableLayoutPanel.Controls.Add(this.lblCountry , 0, 1);
this.tableLayoutPanel.Location = new
System.Drawing.Point(0, 0);
this.tableLayoutPanel.Margin = new
System.Windows.Forms.Padding(0, 3, 0, 3);
this.tableLayoutPanel.Name = "tableLayoutPanel";
this.tableLayoutPanel.RowCount = 6;
this.tableLayoutPanel.RowStyles.Add(new
System.Windows.Forms.RowStyle(System.Windows.Forms .SizeType.Absolute,
15F));
this.tableLayoutPanel.RowStyles.Add(new
System.Windows.Forms.RowStyle());
this.tableLayoutPanel.RowStyles.Add(new
System.Windows.Forms.RowStyle());
this.tableLayoutPanel.RowStyles.Add(new
System.Windows.Forms.RowStyle());
this.tableLayoutPanel.RowStyles.Add(new
System.Windows.Forms.RowStyle());
this.tableLayoutPanel.RowStyles.Add(new
System.Windows.Forms.RowStyle());
this.tableLayoutPanel.Size = new System.Drawing.Size(618,
165);
this.tableLayoutPanel.TabIndex = 0;
//
// txtStreet
//
this.txtStreet.Dock = System.Windows.Forms.DockStyle.Fill;
this.errorProvider.SetIconAlignment(this.txtStreet ,
System.Windows.Forms.ErrorIconAlignment.MiddleLeft );
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.ScrollBars.Vertical;
this.txtStreet.Size = new System.Drawing.Size(512, 32);
this.txtStreet.TabIndex = 1;
//
// txtCity
//
this.txtCity.Dock = System.Windows.Forms.DockStyle.Fill;
this.errorProvider.SetIconAlignment(this.txtCity,
System.Windows.Forms.ErrorIconAlignment.MiddleLeft );
this.txtCity.Location = new System.Drawing.Point(103, 83);
this.txtCity.Name = "txtCity";
this.txtCity.Size = new System.Drawing.Size(512, 20);
this.txtCity.TabIndex = 2;
//
// ddlState
//
this.ddlState.Dock = System.Windows.Forms.DockStyle.Fill;
this.ddlState.DropDownStyle =
System.Windows.Forms.ComboBoxStyle.DropDownList;
this.ddlState.FormattingEnabled = true;
this.errorProvider.SetIconAlignment(this.ddlState,
System.Windows.Forms.ErrorIconAlignment.MiddleLeft );
this.ddlState.Location = new System.Drawing.Point(103,
109);
this.ddlState.Name = "ddlState";
this.ddlState.Size = new System.Drawing.Size(512, 21);
this.ddlState.TabIndex = 3;
//
// ddlCountry
//
this.ddlCountry.Dock = System.Windows.Forms.DockStyle.Fill;
this.ddlCountry.DropDownStyle =
System.Windows.Forms.ComboBoxStyle.DropDownList;
this.ddlCountry.FormattingEnabled = true;
this.errorProvider.SetIconAlignment(this.ddlCountr y,
System.Windows.Forms.ErrorIconAlignment.MiddleLeft );
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.txtPostalCode.Dock =
System.Windows.Forms.DockStyle.Fill;
this.errorProvider.SetIconAlignment(this.txtPostal Code,
System.Windows.Forms.ErrorIconAlignment.MiddleLeft );
this.txtPostalCode.Location = new System.Drawing.Point(103,
136);
this.txtPostalCode.Name = "txtPostalCode";
this.txtPostalCode.Size = new System.Drawing.Size(512, 20);
this.txtPostalCode.TabIndex = 4;
//
// lblStreet
//
this.lblStreet.AutoSize = true;
this.lblStreet.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblStreet.ImeMode =
System.Windows.Forms.ImeMode.NoControl;
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.ContentAlignment.MiddleLeft;
//
// lblCity
//
this.lblCity.AutoSize = true;
this.lblCity.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblCity.ImeMode =
System.Windows.Forms.ImeMode.NoControl;
this.lblCity.Location = new System.Drawing.Point(3, 80);
this.lblCity.Name = "lblCity";
this.lblCity.Size = new System.Drawing.Size(94, 26);
this.lblCity.TabIndex = 0;
this.lblCity.Text = "lblCity";
this.lblCity.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;
//
// lblStateProvince
//
this.lblStateProvince.AutoSize = true;
this.lblStateProvince.Dock =
System.Windows.Forms.DockStyle.Fill;
this.lblStateProvince.ImeMode =
System.Windows.Forms.ImeMode.NoControl;
this.lblStateProvince.Location = new
System.Drawing.Point(3, 106);
this.lblStateProvince.Name = "lblStateProvince";
this.lblStateProvince.Size = new System.Drawing.Size(94,
27);
this.lblStateProvince.TabIndex = 0;
this.lblStateProvince.Text = "lblStateProvince";
this.lblStateProvince.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;
//
// lblPostalCode
//
this.lblPostalCode.AutoSize = true;
this.lblPostalCode.Dock =
System.Windows.Forms.DockStyle.Fill;
this.lblPostalCode.ImeMode =
System.Windows.Forms.ImeMode.NoControl;
this.lblPostalCode.Location = new System.Drawing.Point(3,
133);
this.lblPostalCode.Name = "lblPostalCode";
this.lblPostalCode.Size = new System.Drawing.Size(94, 32);
this.lblPostalCode.TabIndex = 0;
this.lblPostalCode.Text = "lblPostalCode";
this.lblPostalCode.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;
//
// lblCountry
//
this.lblCountry.AutoSize = true;
this.lblCountry.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblCountry.ImeMode =
System.Windows.Forms.ImeMode.NoControl;
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.ContentAlignment.MiddleLeft;
//
// errorProvider
//
this.errorProvider.ContainerControl = this;
//
// AddressUC
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F,
13F);
this.AutoScaleMode =
System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.tableLayoutPanel);
this.DoubleBuffered = true;
this.Name = "AddressUC";
this.Size = new System.Drawing.Size(618, 176);
this.tableLayoutPanel.ResumeLayout(false);
this.tableLayoutPanel.PerformLayout();

((System.ComponentModel.ISupportInitialize)(this.e rrorProvider)).EndInit();
this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.TableLayoutPanel tableLayoutPanel;
private System.Windows.Forms.TextBox txtStreet;
private System.Windows.Forms.TextBox txtCity;
private System.Windows.Forms.ComboBox ddlState;
private System.Windows.Forms.ComboBox ddlCountry;
private System.Windows.Forms.TextBox txtPostalCode;
private System.Windows.Forms.Label lblStreet;
private System.Windows.Forms.Label lblCity;
private System.Windows.Forms.Label lblStateProvince;
private System.Windows.Forms.Label lblPostalCode;
private System.Windows.Forms.Label lblCountry;
private System.Windows.Forms.ErrorProvider errorProvider;

public UserControl1()
{
InitializeComponent();
}
}
}

Dec 13 '06 #4
Hi Dave,

In the "real version" of my application, I use a lot of UserControl (at
least 4) with the TableLayoutPanel (at least 5)... I'll try to reduce
my use of this TableLayoutPanel... It's an interesting track to
follow... I'll try that and let you know !

Thanks !

Martin

Dave Sexton wrote:
Hi Martin,

Well this time I was able to build the solution :)

I think I see the flicker you're referring to, but it's awfully fast on my
computer. TableLayoutPanel is usually the problem, although it still
renders quickly for such a small control.

It sounds to me like it might be your data-access code that is the bottle
neck (you mentioned it in another post in this thread). If so you might
want to use asynchronous calls to the database or use a BackgroundWorker
component to free up the UI thread while it's loading.

Actually, a better question would be, how much flicker is there? What
exactly do you mean by "appear one after one"? Is it painfully obvious or
is it so quick that it's easy to miss (as in my testing)?

To be perfectly honest, if it's really fast then I don't think that there's
anything you can do about it. That's the price you pay when using Controls
to ease development.

--
Dave Sexton

"Martin" <ma*********@gmail.comwrote in message
news:11**********************@j72g2000cwa.googlegr oups.com...
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.

Thanks for your help !

----- Form1.cs -----
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication2
{
public class Form1 : Form
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be
disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#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.splitContainer1 = new
System.Windows.Forms.SplitContainer();
this.button1 = new System.Windows.Forms.Button();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock =
System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0,
0);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.butt on1);
this.splitContainer1.Size = new System.Drawing.Size(642,
305);
this.splitContainer1.SplitterDistance = 425;
this.splitContainer1.TabIndex = 0;
//
// button1
//
this.button1.Location = new System.Drawing.Point(21, 22);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new
System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F,
13F);
this.AutoScaleMode =
System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(642, 305);
this.Controls.Add(this.splitContainer1);
this.Name = "Form1";
this.Text = "Form1";
this.splitContainer1.Panel2.ResumeLayout(false);
this.splitContainer1.ResumeLayout(false);
this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.Button button1;
public Form1()
{
InitializeComponent();
}

private void ShowUserControl(UserControl _objUserControl,
Control _objContainer)
{
_objUserControl.Location = new Point(0, 0);
_objUserControl.Size =
new Size(_objContainer.Width, _objContainer.Height);
_objUserControl.Anchor = AnchorStyles.Top |
AnchorStyles.Bottom |
AnchorStyles.Left |
AnchorStyles.Right;

_objContainer.SuspendLayout();

_objContainer.Controls.Clear();
_objContainer.Controls.Add(_objUserControl);

_objContainer.ResumeLayout();
}

private void button1_Click(object sender, EventArgs e)
{
ShowUserControl(new UserControl1(),
splitContainer1.Panel1);
}
}
}

---- UserControl1.cs ----
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication2
{
public class UserControl1 : UserControl
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be
disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Component 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.tableLayoutPanel = new
System.Windows.Forms.TableLayoutPanel();
this.txtStreet = new System.Windows.Forms.TextBox();
this.txtCity = new System.Windows.Forms.TextBox();
this.ddlState = new System.Windows.Forms.ComboBox();
this.ddlCountry = new System.Windows.Forms.ComboBox();
this.txtPostalCode = new System.Windows.Forms.TextBox();
this.lblStreet = new System.Windows.Forms.Label();
this.lblCity = new System.Windows.Forms.Label();
this.lblStateProvince = new System.Windows.Forms.Label();
this.lblPostalCode = new System.Windows.Forms.Label();
this.lblCountry = new System.Windows.Forms.Label();
this.errorProvider = new
System.Windows.Forms.ErrorProvider(this.components );
this.tableLayoutPanel.SuspendLayout();

((System.ComponentModel.ISupportInitialize)(this.e rrorProvider)).BeginInit();
this.SuspendLayout();
//
// tableLayoutPanel1
//
this.tableLayoutPanel.Anchor =
((System.Windows.Forms.AnchorStyles)(((System.Wind ows.Forms.AnchorStyles.Top
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel.ColumnCount = 2;
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Absolute,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.ColumnStyles.Add(new
System.Windows.Forms.ColumnStyle(System.Windows.Fo rms.SizeType.Percent,
100F));
this.tableLayoutPanel.Controls.Add(this.txtStreet, 1, 2);
this.tableLayoutPanel.Controls.Add(this.txtCity, 1, 3);
this.tableLayoutPanel.Controls.Add(this.ddlState, 1, 4);
this.tableLayoutPanel.Controls.Add(this.ddlCountry , 1, 1);
this.tableLayoutPanel.Controls.Add(this.txtPostalC ode, 1,
5);
this.tableLayoutPanel.Controls.Add(this.lblStreet, 0, 2);
this.tableLayoutPanel.Controls.Add(this.lblCity, 0, 3);
this.tableLayoutPanel.Controls.Add(this.lblStatePr ovince,
0, 4);
this.tableLayoutPanel.Controls.Add(this.lblPostalC ode, 0,
5);
this.tableLayoutPanel.Controls.Add(this.lblCountry , 0, 1);
this.tableLayoutPanel.Location = new
System.Drawing.Point(0, 0);
this.tableLayoutPanel.Margin = new
System.Windows.Forms.Padding(0, 3, 0, 3);
this.tableLayoutPanel.Name = "tableLayoutPanel";
this.tableLayoutPanel.RowCount = 6;
this.tableLayoutPanel.RowStyles.Add(new
System.Windows.Forms.RowStyle(System.Windows.Forms .SizeType.Absolute,
15F));
this.tableLayoutPanel.RowStyles.Add(new
System.Windows.Forms.RowStyle());
this.tableLayoutPanel.RowStyles.Add(new
System.Windows.Forms.RowStyle());
this.tableLayoutPanel.RowStyles.Add(new
System.Windows.Forms.RowStyle());
this.tableLayoutPanel.RowStyles.Add(new
System.Windows.Forms.RowStyle());
this.tableLayoutPanel.RowStyles.Add(new
System.Windows.Forms.RowStyle());
this.tableLayoutPanel.Size = new System.Drawing.Size(618,
165);
this.tableLayoutPanel.TabIndex = 0;
//
// txtStreet
//
this.txtStreet.Dock = System.Windows.Forms.DockStyle.Fill;
this.errorProvider.SetIconAlignment(this.txtStreet ,
System.Windows.Forms.ErrorIconAlignment.MiddleLeft );
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.ScrollBars.Vertical;
this.txtStreet.Size = new System.Drawing.Size(512, 32);
this.txtStreet.TabIndex = 1;
//
// txtCity
//
this.txtCity.Dock = System.Windows.Forms.DockStyle.Fill;
this.errorProvider.SetIconAlignment(this.txtCity,
System.Windows.Forms.ErrorIconAlignment.MiddleLeft );
this.txtCity.Location = new System.Drawing.Point(103, 83);
this.txtCity.Name = "txtCity";
this.txtCity.Size = new System.Drawing.Size(512, 20);
this.txtCity.TabIndex = 2;
//
// ddlState
//
this.ddlState.Dock = System.Windows.Forms.DockStyle.Fill;
this.ddlState.DropDownStyle =
System.Windows.Forms.ComboBoxStyle.DropDownList;
this.ddlState.FormattingEnabled = true;
this.errorProvider.SetIconAlignment(this.ddlState,
System.Windows.Forms.ErrorIconAlignment.MiddleLeft );
this.ddlState.Location = new System.Drawing.Point(103,
109);
this.ddlState.Name = "ddlState";
this.ddlState.Size = new System.Drawing.Size(512, 21);
this.ddlState.TabIndex = 3;
//
// ddlCountry
//
this.ddlCountry.Dock = System.Windows.Forms.DockStyle.Fill;
this.ddlCountry.DropDownStyle =
System.Windows.Forms.ComboBoxStyle.DropDownList;
this.ddlCountry.FormattingEnabled = true;
this.errorProvider.SetIconAlignment(this.ddlCountr y,
System.Windows.Forms.ErrorIconAlignment.MiddleLeft );
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.txtPostalCode.Dock =
System.Windows.Forms.DockStyle.Fill;
this.errorProvider.SetIconAlignment(this.txtPostal Code,
System.Windows.Forms.ErrorIconAlignment.MiddleLeft );
this.txtPostalCode.Location = new System.Drawing.Point(103,
136);
this.txtPostalCode.Name = "txtPostalCode";
this.txtPostalCode.Size = new System.Drawing.Size(512, 20);
this.txtPostalCode.TabIndex = 4;
//
// lblStreet
//
this.lblStreet.AutoSize = true;
this.lblStreet.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblStreet.ImeMode =
System.Windows.Forms.ImeMode.NoControl;
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.ContentAlignment.MiddleLeft;
//
// lblCity
//
this.lblCity.AutoSize = true;
this.lblCity.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblCity.ImeMode =
System.Windows.Forms.ImeMode.NoControl;
this.lblCity.Location = new System.Drawing.Point(3, 80);
this.lblCity.Name = "lblCity";
this.lblCity.Size = new System.Drawing.Size(94, 26);
this.lblCity.TabIndex = 0;
this.lblCity.Text = "lblCity";
this.lblCity.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;
//
// lblStateProvince
//
this.lblStateProvince.AutoSize = true;
this.lblStateProvince.Dock =
System.Windows.Forms.DockStyle.Fill;
this.lblStateProvince.ImeMode =
System.Windows.Forms.ImeMode.NoControl;
this.lblStateProvince.Location = new
System.Drawing.Point(3, 106);
this.lblStateProvince.Name = "lblStateProvince";
this.lblStateProvince.Size = new System.Drawing.Size(94,
27);
this.lblStateProvince.TabIndex = 0;
this.lblStateProvince.Text = "lblStateProvince";
this.lblStateProvince.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;
//
// lblPostalCode
//
this.lblPostalCode.AutoSize = true;
this.lblPostalCode.Dock =
System.Windows.Forms.DockStyle.Fill;
this.lblPostalCode.ImeMode =
System.Windows.Forms.ImeMode.NoControl;
this.lblPostalCode.Location = new System.Drawing.Point(3,
133);
this.lblPostalCode.Name = "lblPostalCode";
this.lblPostalCode.Size = new System.Drawing.Size(94, 32);
this.lblPostalCode.TabIndex = 0;
this.lblPostalCode.Text = "lblPostalCode";
this.lblPostalCode.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;
//
// lblCountry
//
this.lblCountry.AutoSize = true;
this.lblCountry.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblCountry.ImeMode =
System.Windows.Forms.ImeMode.NoControl;
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.ContentAlignment.MiddleLeft;
//
// errorProvider
//
this.errorProvider.ContainerControl = this;
//
// AddressUC
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F,
13F);
this.AutoScaleMode =
System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.tableLayoutPanel);
this.DoubleBuffered = true;
this.Name = "AddressUC";
this.Size = new System.Drawing.Size(618, 176);
this.tableLayoutPanel.ResumeLayout(false);
this.tableLayoutPanel.PerformLayout();

((System.ComponentModel.ISupportInitialize)(this.e rrorProvider)).EndInit();
this.ResumeLayout(false);

}

#endregion

private System.Windows.Forms.TableLayoutPanel tableLayoutPanel;
private System.Windows.Forms.TextBox txtStreet;
private System.Windows.Forms.TextBox txtCity;
private System.Windows.Forms.ComboBox ddlState;
private System.Windows.Forms.ComboBox ddlCountry;
private System.Windows.Forms.TextBox txtPostalCode;
private System.Windows.Forms.Label lblStreet;
private System.Windows.Forms.Label lblCity;
private System.Windows.Forms.Label lblStateProvince;
private System.Windows.Forms.Label lblPostalCode;
private System.Windows.Forms.Label lblCountry;
private System.Windows.Forms.ErrorProvider errorProvider;

public UserControl1()
{
InitializeComponent();
}
}
}
Dec 13 '06 #5

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

Similar topics

2
by: Dave Veeneman | last post by:
Is there a simple way to pass drag-and-drop events to a child control in a UserControl? Here's an example: I have created a UserControl which contains a treeview and some text boxes. I want to...
8
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...
2
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...
41
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...
12
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...
9
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...
6
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...
10
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...
3
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...

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.