By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,561 Members | 3,265 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,561 IT Pros & Developers. It's quick & easy.

Locked property

P: n/a
I'm writing my first windows control library. A simple
textbox with some numeric facilities.
Well, there is a strange thing that happen.

I want to add a locked property. As many other
property, because it's a default property, I must shadow
it, but unfortunately, despite the other properties shadowed,
for instance tabindex, locked continue to stay in design category
also if I set it up to behaviour, and doesn't run my own
code.

Anyone knows what's the problem?

--
Andrea
Nov 20 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Andrea,
TextBox doesn't have a Locked property, so why are you shadowing it?

The Locked property you see in the Properties Window is a Designer property!
Which means the Form designer itself is putting it there as it has special
meaning, similar to the Name & Modifier properties.

You may want to ask "down the hall" in the
microsoft.public.dotnet.framework.windowsforms.des igntime newsgroup, to see
if there is a special attribute you can use to replace one of the Designer
properties.

Hope this helps
Jay

"Andrea Moro" <mo**********@tiscali.it> wrote in message
news:eT**************@TK2MSFTNGP10.phx.gbl...
I'm writing my first windows control library. A simple
textbox with some numeric facilities.
Well, there is a strange thing that happen.

I want to add a locked property. As many other
property, because it's a default property, I must shadow
it, but unfortunately, despite the other properties shadowed,
for instance tabindex, locked continue to stay in design category
also if I set it up to behaviour, and doesn't run my own
code.

Anyone knows what's the problem?

--
Andrea

Nov 20 '05 #2

P: n/a
Well, I was referering to locked property of usercontrol.
By the way, I'll send a post to ng porposed by you and
wait for their answer.

In this way, there a lot of properties that I'd like to hide.

Andrea
Nov 20 '05 #3

P: n/a
Andrea,
UserControl doesn't have a Locked property either! ;-)

In fact there are no Windows Form controls that have a locked property.

The Locked property you see in the Properties Window is a Designer property!
Which means the Form designer itself is putting it there as it has special
meaning, similar to the Name & Modifier properties.

Hope this helps
Jay

"Andrea Moro" <mo**********@tiscali.it> wrote in message
news:O5**************@tk2msftngp13.phx.gbl...
Well, I was referering to locked property of usercontrol.
By the way, I'll send a post to ng porposed by you and
wait for their answer.

In this way, there a lot of properties that I'd like to hide.

Andrea

Nov 20 '05 #4

P: n/a
Jay

this may usefull, but why then I can't add my locked
property. If it has - as it is - only a design means, why
framework wouldn't know to let me add it?

Is there a list of these "designer properties" on which
us haven't any power?

Andrea
Nov 20 '05 #5

P: n/a
Andrea,
this may usefull, but why then I can't add my locked
property. If it has - as it is - only a design means, why
framework wouldn't know to let me add it? You are completely free to add a Locked property to your control, You are
completely free to get & set that property in code. This property DOES NOT
need to be shadowed (as the base class does not have a Locked property!)

Public Class LockableControl
Inherits System.Windows.Forms.UserControl

Private m_locked As Boolean

"Windows Form Designer generated code"

<Browsable(True), _
Category("Appearance"), _
Description("This is my property!")> _
Public Property Locked() As Boolean
Get
Return m_locked
End Get
Set(ByVal value As Boolean)
m_locked = value
End Set
End Property

End Class

You just cannot display the property in the Forms designer, as the forms
designer shows its own Locked property.

As I stated, You may want to ask "down the hall" in the
microsoft.public.dotnet.framework.windowsforms.des igntime newsgroup, to see
if there is a special attribute you can use to replace one of the Designer
properties. I will do some more checking and get back to you.

By "special attribute" I mean a class that inherits from System.Attribute,
such as Browsable, Category & Description in my example above.

If you were able to add you own Locked or Modifiers properties, which makes
some sense to me you should. How would the designer expose its own Locked &
Modifiers properties?
Is there a list of these "designer properties" on which
us haven't any power? Open a form in design mode, look under the "Design" category, there are
three listed (Name), Locked, and Modifiers.

Hope this helps
Jay
"Andrea Moro" <mo**********@tiscali.it> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl... Jay

this may usefull, but why then I can't add my locked
property. If it has - as it is - only a design means, why
framework wouldn't know to let me add it?

Is there a list of these "designer properties" on which
us haven't any power?

Andrea

Nov 20 '05 #6

P: n/a
Just give it a different name. No need to stress over it.

--
Jonathan Allen
"Andrea Moro" <mo**********@tiscali.it> wrote in message
news:eT**************@TK2MSFTNGP10.phx.gbl...
I'm writing my first windows control library. A simple
textbox with some numeric facilities.
Well, there is a strange thing that happen.

I want to add a locked property. As many other
property, because it's a default property, I must shadow
it, but unfortunately, despite the other properties shadowed,
for instance tabindex, locked continue to stay in design category
also if I set it up to behaviour, and doesn't run my own
code.

Anyone knows what's the problem?

--
Andrea

Nov 20 '05 #7

P: n/a
Andrea,
To add a Locked property to your control and have it show up in the
designer:

"You need to create your own designer in this instance and block the base
implementation of PreFilterProperties. ControlDesigner.PreFilterProperties
is responsible for putting "Locked" on the control."

I don't have a clean example of creating your own designer, but you will
need to inherit from ControlDesigner or one of its subclasses. Post if you
need help.

The other option I was going to suggest, which is easier, is the one
Jonathan just suggested, give your Locked property a different name, as the
ControlDesigner itself is adding the property to the grid causing your
Locked property to be hidden.

Hope this helps
Jay
"Andrea Moro" <mo**********@tiscali.it> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Jay

this may usefull, but why then I can't add my locked
property. If it has - as it is - only a design means, why
framework wouldn't know to let me add it?

Is there a list of these "designer properties" on which
us haven't any power?

Andrea

Nov 20 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.