|
|
|
start date: Mon, 20 Aug 2007 13:12:18 -0700,
posted on: microsoft.public.dotnet.framework.windowsforms.controls
back
| Thread Index |
|
1
leepard
|
|
2
leepard
|
Filtering Properties Out
I have created a custom control where I have applied a new custom category to
all properties I would like users to set. All other properties I want to
filter out. For example, I have derived a CustomTextBox from TextBox, and
have filtered out all properties that aren't tagged with my custom category.
(As an example of filtering, I created a CustomTextBoxDesigner which pulls
out properties from the design time execution by overriding
PostFilterProperties).
This all works fine except for one thing. I want to reuse the TextBox's
"Size" property, BUT, have my Category be the new custom category and NOT the
"Layout" category. To do this I have the following:
[Category("NewCustomCategory")]
public new Size Size
{
get {return base.Size;}
set {base.Size = value;}
}
This works great, except, When I resize the CustomTextBox control on the
surface it does not refresh correctly. The size does not update.
Interestingly enough, if I keep everything as is, and keep all "Layout"
categories as well as the custom one, the resize of the text box is now fine.
Can anyone shed some light on why this is?
Date:Mon, 20 Aug 2007 13:12:18 -0700
Author:
|
RE: Filtering Properties Out
I have since figured out that I really needed to ensure not ALL properties
with the "Layout" category get removed. I only wanted to remove those
properties that were of the "Layout" category and that were also browsable.
Doing this instead caused the refresh issue to go away. I'm not quite sure
which property was absolutely necessary. Maybe ClientSize. At any rate, the
issue was some dependency with one of the Non-browsable properties being
removed that the designer required for the control to refresh properly after
a resize of the control.
"leepard" wrote:
> I have created a custom control where I have applied a new custom category to
> all properties I would like users to set. All other properties I want to
> filter out. For example, I have derived a CustomTextBox from TextBox, and
> have filtered out all properties that aren't tagged with my custom category.
> (As an example of filtering, I created a CustomTextBoxDesigner which pulls
> out properties from the design time execution by overriding
> PostFilterProperties).
>
> This all works fine except for one thing. I want to reuse the TextBox's
> "Size" property, BUT, have my Category be the new custom category and NOT the
> "Layout" category. To do this I have the following:
>
> [Category("NewCustomCategory")]
> public new Size Size
> {
> get {return base.Size;}
> set {base.Size = value;}
> }
>
> This works great, except, When I resize the CustomTextBox control on the
> surface it does not refresh correctly. The size does not update.
> Interestingly enough, if I keep everything as is, and keep all "Layout"
> categories as well as the custom one, the resize of the text box is now fine.
>
>
> Can anyone shed some light on why this is?
Date:Tue, 21 Aug 2007 10:50:01 -0700
Author:
|
|
|