Search code examples
c#winformstreeview

Winforms Treeview text being cutoff


I'm using a treeview inside my informs application. When I load up nodes with a lot of text, the text gets chopped at 12 characters. How do I keep this from happening?

Font being used: Microsoft Sans Serif, 12pt, style=Bold

I have tried using plain fonts with no luck.

Here is my code (I've overridden the treenode with another class):

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;

namespace Repetrel
{
    public class ActionObjectTreeNode: TreeNode
    {
    public string fileName = null;

    private ActionObject actionObject = new ActionObject();

    public string Text {
        get { return base.Text; }
        set {
            if (value.Equals(base.Text) == false && base.Text!="")
            {
                Trace.WriteLine("error detected");
            }
            base.Text = value;
        }
    }

    public ActionObject ACTIONOBJECT
    {
        get
        {
            return actionObject;
        }

        set
        {
            actionObject = value;
            if (value == null && TREENODETYPE != TreeNodeType.Project) {
                System.Diagnostics.Trace.WriteLine("null assigned to actionobject");
            }
        }
    }
    public TreeNodeType TREENODETYPE { get; set; }
    public TreeNodeType LOCKEDNODETYPE { get; set; }
    public DrillActionGroup ACTIONPROPERTIES { get; set; }

    public ActionObjectTreeNode()
    {

    }

    public ActionObjectTreeNode(string text)
    {
        this.Text = text;
    }

    public ActionObjectTreeNode(ActionObject actionObject)
    {
        if (actionObject != null)
        {
            this.Text = actionObject.TEXT;
            this.ACTIONOBJECT = actionObject;
        }
    }


    public bool guidMatch(string _guid)
    {
        return ACTIONOBJECT.getGuid().Equals(_guid);       
    }

}

}


Solution

  • Apparently I was cropping the text inside the treeview itself. Problem solved. Thanks for all the help!