Nevron Forum

NTreeList custom painting

https://www.nevron.com/Forum/Topic4432.aspx

By Eshar Gal - Thursday, November 4, 2010

I need to draw a few lines on a TreeList. For some reason the NTreeList.Paint won't work, is there a way to make it work or any other way to add some custom drawings?

Thanks.
By Nevron Support - Thursday, November 4, 2010

Hi Eshar,

Most of our UI controls has Property Renderer which is responsible for the control's drawing.

In your case to make some custom drawing you should create renderer class that inherits from NTreeViewExRenderer (NTreeList is a child class of NTreeViexEx control so NTreeList use NTreeViewExRenderer as a renderer) and override some of its methods.

For example you can override PaintBackground and add your drawing in it.

public class MyNTreeViewExRenderer : NTreeViewExRenderer
{
    public override bool PaintBackground(NTreeNode node, NTreeViewExPaintContext context)
    {
        //Do your drwawing using context.Graphics. ...
        return base.PaintBackground(node, context);
    }
}

Then you should set an instance of this class to the NTreeList.Renderer.

In this case to be able to view your custom drawing you should have at least one node in your NTreeList.

By Eshar Gal - Sunday, November 7, 2010

Perfect, thanks!