GoTextNode size

Hi Support!

I would like to know if there is a way to define a minimum size ( W,H), para GoTextNode object ?

I created a class to define a GoTextNode object, and I would like to define a minimum size…

Thanks!

MyCLass:

//Class: Group
[Serializable]
public class GroupItem : GoTextNode
{
//Variables
//This field keeps track of this process item image
private ProcessItemImage mProcessItemImage;
private Color mfirst_color = Color.White;
private Color msecond_color = Color.White;

    //Constructor with parameter to create Group Item
    public GroupItem()
    {
        mProcessItemImage = null;
        mfirst_color = Color.FromArgb(159, 232, 0);
        msecond_color = Color.White;

        ConfigureGroupItem(ItemKind.GroupItem, mfirst_color, msecond_color);
    }


    //This property is for convenience in accessing the Process Item Image class
    public ProcessItemImage ProcessImage
    {
        get { return mProcessItemImage; }
    }



    //Adjust port positions for certain background shapes
    public override void LayoutChildren(GoObject childchanged)
    {
        base.LayoutChildren(childchanged);

        //Get Process Image
        ProcessItemImage dec = this.ProcessImage;
        //Check if image exists and Rectangle as background
        if (dec != null && this.Background != null)
        {
            //Set image position
            PointF pt = new PointF(this.Background.Right - 3, this.Background.Top + 1);
            if (dec.Image != null)
            {
                dec.Image.SetSpotLocation(TopRight, pt);
            }
        }

    }



    //Configure each Group process item
    private void ConfigureGroupItem(ItemKind PrcItemKind, Color first, Color second)
    {
        //Insert Image
        ProcessItemImage m_PocessItemImage = new ProcessItemImage(ItemKind.GroupItem);
        mProcessItemImage = m_PocessItemImage;
        InsertBefore(this.Background, m_PocessItemImage);

        //Set background
        GoRoundedRectangle bkground_shape = new GoRoundedRectangle();
        bkground_shape.Corner = new SizeF(5, 5);
        Pen pen = new Pen(Color.Black);
        pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
        bkground_shape.Pen = pen;
        this.Background = bkground_shape;
        if (ProcessImage != null)
        {
            this.ProcessImage.AutoRescales = false;
        }
        this.Shape.FillShapeHighlight(first, second);
        this.TopLeftMargin = new SizeF(35, 20);
        this.BottomRightMargin = new SizeF(35, 20);
        this.Editable = false;
        this.Shadowed = false;
        this.Resizable = true;
        this.ResizesRealtime = true;
        this.Reshapable = true;
        this.AutoResizes = false;
        this.TopPort.Visible = false;
        this.BottomPort.Visible = false;
        this.LeftPort.Visible = false;
        this.RightPort.Visible = false;


    }
}

Minimum size when resized by the user?

yes…

Look at what DoResize does in the InfoNode4 class of the NodeLinkDemo sample.

Hi Jake,

I inserted the DoResize() overload in my GoTextNode class,… but DoResize() was not called…What´s wrong ? See my class:

//GroupProcessItem Class: Group
[Serializable]
public class GroupItem : GoTextNode
{
    private ResourceManager rm;
    //This field keeps track of this process item image
    private ProcessItemImage mProcessItemImage;
    private Color mfirst_color = Color.White;
    private Color msecond_color = Color.White;



    //Constructor with parameter to create Group Item
    public GroupItem()
    {
        //Resources
        rm = new ResourceManager("constants", this.GetType().Assembly);

        //Reset variables
        mProcessItemImage = null;
        mfirst_color = Color.FromArgb(159, 232, 0);
        msecond_color = Color.White;

        ConfigureGroupItem(ItemKind.GroupItem, mfirst_color, msecond_color);
    }



    //This property is for convenience in accessing the Process Item Image class
    public ProcessItemImage ProcessImage
    {
        get { return mProcessItemImage; }
    }



    //Adjust port positions for certain background shapes
    public override void LayoutChildren(GoObject childchanged)
    {
        base.LayoutChildren(childchanged);

        //Get Process Image
        ProcessItemImage dec = this.ProcessImage;
        //Check if image exists and Rectangle as background
        if (dec != null && this.Background != null)
        {
            //Set image position
            PointF pt = new PointF(this.Background.Right - 3, this.Background.Top + 1);
            if (dec.Image != null)
            {
                dec.Image.SetSpotLocation(TopRight, pt);
            }
        }

    }



    //Configure each Group process item
    private void ConfigureGroupItem(ItemKind PrcItemKind, Color first, Color second)
    {
        //Insert Image
        ProcessItemImage m_PocessItemImage = new ProcessItemImage(ItemKind.GroupItem);
        mProcessItemImage = m_PocessItemImage;
        InsertBefore(this.Background, m_PocessItemImage);

        //Set background
        GoRoundedRectangle bkground_shape = new GoRoundedRectangle();
        bkground_shape.Corner = new SizeF(5, 5);
        Pen pen = new Pen(Color.Black);
        pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
        bkground_shape.Pen = pen;
        this.Background = bkground_shape;
        if (ProcessImage != null)
        {
            this.ProcessImage.AutoRescales = false;
        }
        this.Shape.FillShapeHighlight(first, second);
        this.TopLeftMargin = new SizeF(35, 20);
        this.BottomRightMargin = new SizeF(35, 20);
        this.Editable = false;
        this.Shadowed = false;
        this.Resizable = true;
        this.ResizesRealtime = true;
        this.Reshapable = true;
        this.AutoResizes = false;
        this.TopPort.Visible = false;
        this.BottomPort.Visible = false;
        this.LeftPort.Visible = false;
        this.RightPort.Visible = false;


    }



    public override void DoResize(GoView view, RectangleF origRect, PointF newPoint, int whichHandle, GoInputState evttype, SizeF min, SizeF max)
    {
        base.DoResize(view, origRect, newPoint, whichHandle, evttype, new SizeF(100, 50), max);  // specify minimum resizing Size
    }
}

DoResize gets called on whatever object is selectable. Most likely your Shape.