Hello!
I have encountered with the following problem:
I need to arrange objects into the GoPalette so that each object would be placed in its own row. How can i do that?
Thanks!!!
Hello!
I have encountered with the following problem:
I need to arrange objects into the GoPalette so that each object would be placed in its own row. How can i do that?
Thanks!!!
GoPalette uses GridOriginX, GridOriginY, GridCellSizeWidth and GridCellSizeHeight to set the layout
grid for the objects. I think just setting GridCellSizeWidth to a large number would work.
NodeLinkDemo also does something in CustomizePalette to do it’s own 1 per row layout.
Thank you for your answer, Jake!
I have solved this problem with the following way:
I overrided the OnLayout method of GoPalette:
protected override void OnLayout(LayoutEventArgs levent)
{
if (AutomaticLayout)
{
base.OnLayout(levent);
}
else
{
var palette = levent.AffectedControl as GoPalette;
if (palette != null && levent.AffectedProperty == "Bounds")
{
GoObject prevOb = null;
foreach (var layer in palette.Layers)
{
foreach (GoObject ob in layer)
{
if (ob is GoIconicNode)
{
ob.Bounds = new RectangleF(palette.Width / 2 - ob.Width / 2,
ob.Bounds.Y < 0
? 0
: prevOb == null
? 5
: prevOb.Bounds.Y + prevOb.Bounds.Height + 5,
ob.Bounds.Width, ob.Bounds.Height);
prevOb = ob;
}
}
}
}
}
}