GoDigram for .NET Framework and .NET Core
Northwoods.Go Namespace / GoGeneralNode Class / LayoutIcon Method
In This Topic
    LayoutIcon Method
    In This Topic
    Resize the Icon so that it meets the MinimumIconSize requirement.
    Syntax
    protected virtual void LayoutIcon()
    Remarks
    This only happens when GoObject.AutoRescales is true for the Icon. MinimumIconSize is computed to be large enough to hold all of the ports. If you want the Icon to automatically shrink in size when ports are removed, override this method as follows:
    
                    protected override void LayoutIcon() {
                      GoObject icon = this.Icon;
                      if (icon != null && icon.AutoRescales) {
                        SizeF minIconSize = this.MinimumIconSize;
                        float newW = minIconSize.Width;
                        float newH = minIconSize.Height;
                        icon.Bounds = new RectangleF(icon.Left - (newW - icon.Width)/2, icon.Top - (newH - icon.Height)/2, newW, newH);
                      }
                    }
                
    See Also