Altering Default GridSize

A

Anthony Williams

Hi,
I am implementing a Forms designer in my application and would like to
alter the default grid size used by the form.
The only place I can find the property for GridSize is protected in the
class System.Windows.Forms.Design.ParentControlDesigner and I can't for
the life of me figure out a way of getting an object of this kind from
the wonderful spaghetti that is my implementation of the .NET designer
hosting framework!!

Does anyone have any bright idea's as to how I can go about modifying
the grid size on the designer?
Thanks,
Anthony Williams
 
G

Guest

' Set the GridSize
Dim _designer As IDesigner = _designerHost.GetDesigner(_baseForm)
Dim _type As Type = DirectCast(_designer, Object).GetType
_type.InvokeMember("GridSize", Reflection.BindingFlags.NonPublic Or
Reflection.BindingFlags.SetProperty Or Reflection.BindingFlags.Instance Or
Reflection.BindingFlags.FlattenHierarchy, Nothing, _designer, New Object()
{New Size(4, 4)})
 

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