all groups > dotnet windows forms designtime > july 2006 >
You're in the

dotnet windows forms designtime

group:

designers typeof(IRootDesigner)


designers typeof(IRootDesigner) Krzysztof Gorniak
7/13/2006 11:35:58 PM
dotnet windows forms designtime:
hi there,

I'm looking for good tutorial on making iroot designer.

I need a custom designer just like this one
http://windowsforms.net/articles/shapedesigner.aspxbut i want the shape to
be a containerfor onthers windows forms controls. Is it possible ?Are there
any good books or other knowledge sources where i can learn about developing
custom iroot designers ? thanks in advance,Krzysztof Gorniak

RE: designers typeof(IRootDesigner) v-lliu NO[at]SPAM online.microsoft.com
7/14/2006 11:56:00 AM
Hi Kris,

Thank you for posting.

This is a quick note to let you know I am researching on this issue and
will get back to you as soon as possible. I appreciate your patience.


Sincerely,
Linda Liu
Microsoft Online Community Support

============================================================================
=============================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

With newsgroups, MSDN subscribers enjoy unlimited, free support as opposed
to the limited number of phone-based technical support incidents. Complex
issues or server-down situations are not recommended for the newsgroups.
Issues of this nature are best handled working with a Microsoft Support
Engineer using one of your phone-based incidents.

============================================================================
=============================================
This posting is provided "AS IS" with no warranties, and confers no rights.
RE: designers typeof(IRootDesigner) v-lliu NO[at]SPAM online.microsoft.com
7/17/2006 10:35:33 AM
Hi Kris,

I don't think it is possible to put Windows Form controls onto the shape.
The reason is that the Shapes property of the ShapeContainer class is of
type ShapeCollection which can only contains objects of type Shape.

You may refer to the following link to learn about developing custom
IRootDesigner.

http://msdn2.microsoft.com/en-us/library/system.componentmodel.design.irootd
esigner(d=ide).aspx

Hope this helps.
If you have anything unclear, please feel free to let me know.


Sincerely,
Linda Liu
Microsoft Online Community Support

============================================================================
=============================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

With newsgroups, MSDN subscribers enjoy unlimited, free support as opposed
to the limited number of phone-based technical support incidents. Complex
issues or server-down situations are not recommended for the newsgroups.
Issues of this nature are best handled working with a Microsoft Support
Engineer using one of your phone-based incidents.

============================================================================
=============================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Re: designers typeof(IRootDesigner) Roman
7/17/2006 7:28:30 PM
Hi Kris
Have you tried to inherit from
System.Windows.Forms.Design.DocumentDesigner? It implements iroot designer
interface and can contain controls. And the most pleasant thing: it contains
virtual methods (there are a lot of sealed and internal members and classes
in VS DT. I hate them) so you can override it's behaviour to your needs :).
--
Thanks Roman
--
[quoted text, click to view]

Re: designers typeof(IRootDesigner) Krzysztof Gorniak
7/18/2006 10:01:46 PM
Hello there,

first of all - thanks for interesting.

System.Windows.Forms.Design.DocumentDesigner has all i need ...
but when i use it with UserControl for example there is always
a border of control and small padding on the top and left which i mustn't
have.

When i try to go "one step higher" and derrive from ScrolableControl
designer
i can't drop windows forms controls on my control.

So at the time i'm stuck.

I would appreciate any help.

regards,

Krzysztof Gorniak


[quoted text, click to view]

Re: designers typeof(IRootDesigner) v-lliu NO[at]SPAM online.microsoft.com
7/21/2006 1:23:37 PM
Hi Kris,

Thank you for your response.

My answers to your two questions are listed below.

1. About DocumentDesigner

I performed a test on the DocumentDesigner. I set up a Windows project, in
which I derive a class called MyDesigner from DocumentDesigner class.
Below is the code of the MyDesigner class.

using System.Windows.Forms.Design;
using System.ComponentModel.Design;
using System.Windows.Forms;

public class MyDesigner : DocumentDesigner
{
public override DesignerVerbCollection Verbs
{
get
{
// add a verb to the designer to distinguish between the
default form designer
DesignerVerbCollection c = base.Verbs;
c.Add(new DesignerVerb("MYVERB", new EventHandler(EH)));
return c;
}
}

private void EH(object sender, EventArgs e)
{
MessageBox.Show("MY VERB!");
}
}

Then I add a UserControl named UserControl1 in the project and add
DesignerAttribute[typeof(MyDesigner),typeof(IRootDesigner)] to the
UserControl1 class. The statements are shown below.

using System.ComponentModel.Design;

[Designer(typeof(MyDesigner), typeof(IRootDesigner))]
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
}

When I open the UserControl1 in designer and right click on it, the verb
"MYVERB" won't appear in the context menu. This is because the UserControl1
is displayed by VS with the default designer. The new designer--MyDesigner
only takes effect on the class derived from the UserControl1.

I didn't see the problem that " there is always a border of control and
small padding on the top and left ". Would you tell me what you mean by
that?

2. About ScrollableControlDesigner

ScrollableControlDesiger should be only used with srcollable control, such
as Panel. But it doesn't provide a root-level design mode view. So
ScrollableControlDesigner couldn't be associated with a form or user
control.

I have performed a test but I didn't reproduce the problem you described.
Below is the steps of my test.

a. Inherite a new class from ScrollableDesigner. The code of the new class
is like below.

using System.Windows.Forms.Design;
using System.ComponentModel.Design;
using System.Windows.Forms;

class MyScollableControlDesigner:ScrollableControlDesigner
{
public override DesignerVerbCollection Verbs
{
get
{
DesignerVerbCollection c = base.Verbs;
c.Add(new DesignerVerb("MYVERB", new EventHandler(EH)));
return c;
}
}

private void EH(object sender, EventArgs e)
{
MessageBox.Show("MY VERB in scrollable component!");
}
}

b. Inherite a new class named MyPanel from Panel and associate the new
designer with MyPanel.The code of the new class is like below.

using System.Windows.Forms;
using System.ComponentModel;

[DesignerAttribute(typeof(MyScollableControlDesigner))]
public class MyPanel:Panel
{ }

c. Build the project and drag&drop a MyPanel from toolbox onto a form.
d. Drag&drop a common control onto the MyPanel on the form in the designer.

Hope this helps.
If you have anything unclear or any questions, please feel free to let me
know.


Sincerely,
Linda Liu
Microsoft Online Community Support
Re: designers typeof(IRootDesigner) v-lliu NO[at]SPAM online.microsoft.com
7/25/2006 11:31:15 AM
Hi Kris,

I am closely monitoring the newsgroup and I am contacting you to check the
issue status.

If the problem is not resolved or you have anything unclear, please feel
free to post in the newsgroup and we will follow up.

Thank you for using our MSDN Managed Newsgroup Support Service!


Sincerely,
Linda Liu
Microsoft Online Community Support

AddThis Social Bookmark Button