protected void ImportTree(){DataClassesDataContext db = new DataClassesDataContext();var izbrani = from f in db.VrniStrukturo(847)select f.id_sodelavec;var sod = from s in db.sodelavecs where izbrani.Contains(s.id_sodelavec)select s;// clear the documentNDrawingView1.Document.ActiveLayer.RemoveAllChildren();NTreeDataSourceImporter treeimport = new NTreeDataSourceImporter();treeimport.Document = NDrawingView1.Document;treeimport.DataSource = sod;treeimport.IdColumnName = "id_sodelavec";treeimport.ParentIdColumnName = "id_mentor";// create vertices as rectangles shapesNBasicShapesFactory shapesFactory = new NBasicShapesFactory();treeimport.VertexShapesFactory = shapesFactory;treeimport.VertexShapesName = BasicShapes.Rectangle.ToString();// use layered tree layoutNLayeredTreeLayout layout = new NLayeredTreeLayout(); layout.Direction = LayoutDirection.LeftToRight;layout.OrthogonalEdgeRouting = true;layout.LayerAlignment = RelativeAlignment.Near;treeimport.Layout = layout;// subscribe for the vertex imported event,// which is raised when a shape was created for a data source recordtreeimport.VertexImported += new ShapeImportedDelegate(OnVertexImported);treeimport.ImportFailed += new EventHandler(treeimport_ImportFailed);// importtreeimport.Import();NDrawingView1.Document.SizeToContent();}void treeimport_ImportFailed(object sender, EventArgs e){throw new NotImplementedException();}private void OnVertexImported(NDataSourceImporter importer, NShape shape, INDataRecord dataRecord){// display the page title in the shapeobject text = dataRecord.GetColumnValue("ime");if (text == null){shape.Text = "Title not specified";}else{shape.Text = text.ToString();}shape.SizeToText(new NMarginsF(10));// make the URL a tooltip of the shapeobject url = dataRecord.GetColumnValue("priimek");if (url == null || url.ToString().Length == 0){shape.Style.InteractivityStyle = new NInteractivityStyle("URL not specified");}else{shape.Style.InteractivityStyle = new NInteractivityStyle(url.ToString());}}