I wrote my own WinForm controls inherited from
standard controls f.e. formatted TextBox etc...
All worked perfectly with Vs.net 2002 but when i
add my controls to a form visually with 2003 version
it's bahaviour is strange. F.e. I add my simple label control
to a form tab control. It looks ok but when i'm running the project
it disapperas. In the windows forms generated code i see
that this control wasn't addes to a tab control really. There is no
this.tabControl0.Controls.Add(this.label0);
Control itself have no text property even if i set this before. There is no
this.label0.Text = "My text";
And the control size isn't set. There is some bug in WinForms generator?
Or I'm doing something wrong?
My control's code:
using System;
using System.Drawing;
using System.Collections;
using System.Diagnostics;
using System.Windows.Forms;
using System.ComponentModel;
namespace Datacomp.DatacompControls
{
/// <summary>
/// DatacompLabel [Jacek 2002-11-19]
/// </summary>
public class DatacompLabel : System.Windows.Forms.Label
{
#region Members
private System.Windows.Forms.ToolTip toolTip1;
private System.ComponentModel.IContainer components;
#endregion
#region Constructors [Jacek 2002-10-20]
/// <summary>
/// Konstruktor komponentu.
/// </summary>
public DatacompLabel()
{
InitializeComponent();
}
/// <summary>
/// Konstruktor komponentu.
/// </summary>
/// <param name="container">Kontener rodzicielski.</param>
public DatacompLabel(System.ComponentModel.IContainer container)
{
container.Add(this);
InitializeComponent();
}
#endregion
#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.toolTip1 = new
System.Windows.Forms.ToolTip(this.components);
//
// DatacompLabel
//
this.AutoSize = true;
this.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.Size = new System.Drawing.Size(0, 13);
}
#endregion
#region Propertys implementation [Jacek 2002-10-24]
/// <summary>
/// Czy automatyczne dopasowanie rozmiaru?
/// </summary>
[DefaultValue(true)]
public override bool AutoSize
{
get{return base.AutoSize;}
set{base.AutoSize = value;}
}
/// <summary>
/// Rodzaj spłaszczenia.
/// </summary>
[DefaultValue(System.Windows.Forms.FlatStyle.System )]
public new System.Windows.Forms.FlatStyle FlatStyle
{
get{return base.FlatStyle;}
set{base.FlatStyle = value;}
}
#endregion
}
}