Discussion:
Using classes not derived from control at design time?
(too old to reply)
Toma Catalin
2008-07-17 09:12:03 UTC
Permalink
Hy there, I am working on a project and I want to add design time support. My
problem is that I don't want to create controls. For example,some times I
just need a class tat has a location,size and an Image propoerty, and I want
to set this properties at design time. I don't need to derive from Control.
Is there any way I can create a lightweight control+designer? A control has
hundreds of properties..they slow down my application. I just want to drag a
class on the form and to see serialized code for 3 properties.
Thanks in advance.
--
Toma Catalin, Microsoft Student Partner
eschneider
2008-07-21 19:54:01 UTC
Permalink
Try making a simple control with you three properties and mark all unneeded
properties with:

[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]

You can also use properties ShouldSerialize[Property Name] to dynamically
determine serialization.

You may need to shadow existing properties to hide them.

Schneider
Post by Toma Catalin
Hy there, I am working on a project and I want to add design time support. My
problem is that I don't want to create controls. For example,some times I
just need a class tat has a location,size and an Image propoerty, and I want
to set this properties at design time. I don't need to derive from Control.
Is there any way I can create a lightweight control+designer? A control has
hundreds of properties..they slow down my application. I just want to drag a
class on the form and to see serialized code for 3 properties.
Thanks in advance.
--
Toma Catalin, Microsoft Student Partner
Toma Catalin
2008-07-22 10:14:33 UTC
Permalink
My problem is the hierarchy behind the Control. Plus, it has a HWND, so it's
like I am creating a form without a border. For most of my needs,I don't need
messages to be passed to my visual classes. I know I can hide all code
serialization, bot it's still a Control that is derived and implements a lot
of classes and interfaces, wich I don't need.

I started deriving my classes from Component, but I still can't write a
designer that will show my Component at design time on the visual surface...
--
Toma Catalin, Microsoft Student Partner
Post by eschneider
Try making a simple control with you three properties and mark all unneeded
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
You can also use properties ShouldSerialize[Property Name] to dynamically
determine serialization.
You may need to shadow existing properties to hide them.
Schneider
Post by Toma Catalin
Hy there, I am working on a project and I want to add design time support. My
problem is that I don't want to create controls. For example,some times I
just need a class tat has a location,size and an Image propoerty, and I want
to set this properties at design time. I don't need to derive from Control.
Is there any way I can create a lightweight control+designer? A control has
hundreds of properties..they slow down my application. I just want to drag a
class on the form and to see serialized code for 3 properties.
Thanks in advance.
--
Toma Catalin, Microsoft Student Partner
eschneider
2008-07-23 20:33:11 UTC
Permalink
All controls are forms underneath, there is no way around it.

Maybe you want to create your own design surface (like a custom drawn design
surface), otherwise I think what I suggested it the best approach.

Schneider
Post by Toma Catalin
My problem is the hierarchy behind the Control. Plus, it has a HWND, so it's
like I am creating a form without a border. For most of my needs,I don't need
messages to be passed to my visual classes. I know I can hide all code
serialization, bot it's still a Control that is derived and implements a lot
of classes and interfaces, wich I don't need.
I started deriving my classes from Component, but I still can't write a
designer that will show my Component at design time on the visual surface...
--
Toma Catalin, Microsoft Student Partner
Post by eschneider
Try making a simple control with you three properties and mark all unneeded
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
You can also use properties ShouldSerialize[Property Name] to dynamically
determine serialization.
You may need to shadow existing properties to hide them.
Schneider
Post by Toma Catalin
Hy there, I am working on a project and I want to add design time
support.
My
problem is that I don't want to create controls. For example,some times I
just need a class tat has a location,size and an Image propoerty, and I want
to set this properties at design time. I don't need to derive from Control.
Is there any way I can create a lightweight control+designer? A control has
hundreds of properties..they slow down my application. I just want to
drag
a
class on the form and to see serialized code for 3 properties.
Thanks in advance.
--
Toma Catalin, Microsoft Student Partner
Loading...