Text property and the Toolbox

  • Thread starter Thread starter steve bull
  • Start date Start date
S

steve bull

I have created a label control and got it to appear in the toolbox. The problem I have is that while all the other
properties appear for the contro I can't get the Text property to appear at all. I have tried in both the DataBindings
category and the Appearance category but it won't appear in either. Am I missing something or do I have to do something
extra for the Text property?

I have included the part of the code which seems relevant. Does anyone have any idea what I am doing wrong?

Thanks, Steve





public class ThreeDLabel : System.Windows.Forms.UserControl
{
private System.ComponentModel.Container components = null;

private string m_Text = "Initial String";
private Font m_Font = new Font("Arial", 20, FontStyle.Bold);



[Category("DataBindings")]
[Description("Control text")]


//Override the base Text Property


public override string Text
{
get
{
return m_Text;
}
set
{
m_Text = value;
this.Refresh();
}
}


[Category("Appearance")]
[Description("Sets the Font for the Text property")]

public Font TextFont
{
get
{
return m_Font;
}
set
{
m_Font = value;
this.Refresh();
}
}

etc.
 
This is related to attribute inheritance.
http://www.google.ca/groups?hl=en&lr=&selm=#[email protected]

--
Tim Wilson
..Net Compact Framework MVP

steve bull said:
I have created a label control and got it to appear in the toolbox. The
problem I have is that while all the other
properties appear for the contro I can't get the Text property to appear
at all. I have tried in both the DataBindings
category and the Appearance category but it won't appear in either. Am I
missing something or do I have to do something
extra for the Text property?

I have included the part of the code which seems relevant. Does anyone
have any idea what I am doing wrong?
Thanks, Steve





public class ThreeDLabel : System.Windows.Forms.UserControl
{
private System.ComponentModel.Container components = null;

private string m_Text = "Initial String";
private Font m_Font = new Font("Arial", 20, FontStyle.Bold);



[Category("DataBindings")]
[Description("Control text")]


//Override the base Text Property


public override string Text
{
get
{
return m_Text;
}
set
{
m_Text = value;
this.Refresh();
}
}


[Category("Appearance")]
[Description("Sets the Font for the Text property")]

public Font TextFont
{
get
{
return m_Font;
}
set
{
m_Font = value;
this.Refresh();
}
}

etc.
 
Back
Top