Writing controls

C

Claire

Hi, Im new at user control writing in dotnet.
I've written a simple gradient painted panel control based on the
UserControl class.
It works reasonably, but the properties arent being persisted. Also I want
to expose the base Text property as I like how the IDE generates control
names automatically.
In the short term would someone tell me how to do these.
In the long term, has anyone written any articles explaining how to get
started on writing controls? My google skills are failing to find anything
written for noobs. A link would be appreciated

thanks
Claire

the following code is totally wrong in getting/setting text. I tried
base.text but there doesnt seem to be a base.text even though the compiler
tells me that my implementation hides it.

[Browsable(true)]
public override string Text
{
get
{
return base.Text
}
set
{
base.Text = value;
}
}
 
S

schneider

As far as the Text property showing the following works:

[EditorBrowsable(EditorBrowsableState.Always)]

[Browsable(true)]

public override string Text {

get {

return base.Text;

}

set {

base.Text = value;

}

}


Panel is specificly trying to hide them:
<EditorBrowsable(EditorBrowsableState.Never), Bindable(False),
Browsable(False)> _
Public Overrides Property [Text] As String
Get
Return MyBase.Text
End Get
Set(ByVal value As String)
MyBase.Text = value
End Set
End Property
I don't know or use any books myself for .NET, but
http://www.codeproject.com/ has lot of control samples...As for the non
persisting propeties they must be read/write, otherwise post a few and maybe
we can help you better.Thanks,Schneider
 
S

schneider

Seems is works with-out the Editor attribute, VS designer is missleading
because it caches the control, sometimes you must close VS to see the new
behavior of the control. A new problem since version 2005+ and very annoying
for control developers! There is a lot of thing they broke for control
designer in 2005+ !

Schneider

// [EditorBrowsable(EditorBrowsableState.Always)]

[Browsable(true)]

public override string Text {

get {

return base.Text;

}

set {

base.Text = value;

}

}


schneider said:
As far as the Text property showing the following works:

[EditorBrowsable(EditorBrowsableState.Always)]

[Browsable(true)]

public override string Text {

get {

return base.Text;

}

set {

base.Text = value;

}

}


Panel is specificly trying to hide them:
<EditorBrowsable(EditorBrowsableState.Never), Bindable(False),
Browsable(False)> _
Public Overrides Property [Text] As String
Get
Return MyBase.Text
End Get
Set(ByVal value As String)
MyBase.Text = value
End Set
End Property
I don't know or use any books myself for .NET, but
http://www.codeproject.com/ has lot of control samples...As for the non
persisting propeties they must be read/write, otherwise post a few and
maybe we can help you better.Thanks,Schneider


Claire said:
Hi, Im new at user control writing in dotnet.
I've written a simple gradient painted panel control based on the
UserControl class.
It works reasonably, but the properties arent being persisted. Also I
want to expose the base Text property as I like how the IDE generates
control names automatically.
In the short term would someone tell me how to do these.
In the long term, has anyone written any articles explaining how to get
started on writing controls? My google skills are failing to find
anything written for noobs. A link would be appreciated

thanks
Claire

the following code is totally wrong in getting/setting text. I tried
base.text but there doesnt seem to be a base.text even though the
compiler tells me that my implementation hides it.

[Browsable(true)]
public override string Text
{
get
{
return base.Text
}
set
{
base.Text = value;
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top