Windows Forms Designer question

G

Guest

Hi
I'm trying to develop a development tool for a business object that conceptually resembles Windows forms. I read the brilliant article by Tim Dawson about hosting the forms designer at: http://www.divil.co.uk/net/articles/designers/hosting.asp, which was just the ticket.

My question, for anyone who has done work in this area, is how do I programmatically access the GridSize property of the designer form? I want to fix it at a particular value other than the default. I know it's a property of ParentControlDesigner, but I can't figure out what to manipulate in code so I can change it from 8 X 8 to my custom figure.

Anyone overridden GridSize anywhere...?
Thanks.
Sean
 
D

DotNetJunkies User

IDesigner designer = host.GetDesigner(form);
Type t = designer.GetType();
t.InvokeMember("GridSize",BindingFlags.NonPublic|BindingFlags.SetProperty|BindingFlags.Instance|BindingFlags.FlattenHierarchy,null,designer,new object[]{new Size(6,6)});


here host should implement the IDesignerHost interface, you know what it is! :)
 
G

Guest

Excellent! It works like a charm.

The really good news is that I can stop kicking myself for not figuring it
out before, though. I never would have thought of trying your solution...

Thanks again.
 

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