/// <summary> /// Create and initialize a <see cref="T:Northwoods.Go.GoImage" /> to act as the node's icon. /// </summary> /// <param name="imglist"></param> /// <param name="imgindex"></param> /// <returns> /// a <see cref="T:Northwoods.Go.GoNodeIcon" /> that obeys this node's <see cref="P:Northwoods.Go.GoSimpleNode.MinimumIconSize" /> /// and <see cref="P:Northwoods.Go.GoSimpleNode.MaximumIconSize" /> properties /// </returns> /// <example> /// If you override this method, you may want the definition to do /// some of the things that the standard definition does: /// <code> /// protected virtual GoObject CreateIcon(System.Windows.Forms.ImageList imglist, int imgindex) { /// GoNodeIcon ni = new GoNodeIcon(); /// ni.ImageList = imglist; /// ni.Index = imgindex; /// ni.MinimumIconSize = new SizeF(20, 20); /// ni.MaximumIconSize = new SizeF(100, 200); /// ni.Size = ni.MinimumIconSize; /// return ni; /// } /// </code> /// </example> protected virtual GoObject CreateIcon(ImageList imglist, int imgindex) { GoNodeIcon obj = new GoNodeIcon { ImageList = imglist, Index = imgindex, MinimumIconSize = new SizeF(20f, 20f), MaximumIconSize = new SizeF(100f, 200f) }; obj.Size = obj.MinimumIconSize; return(obj); }
/// <summary> /// Create and initialize a <see cref="T:Northwoods.Go.GoImage" /> or a <see cref="T:Northwoods.Go.GoDrawing" /> to act as the node's icon. /// </summary> /// <param name="res"></param> /// <param name="iconname"> /// a null value causes no <see cref="T:Northwoods.Go.GoNodeIcon" /> to be allocated, /// but instead a <see cref="T:Northwoods.Go.GoDrawing" /> initialized to look like a rectangle. /// </param> /// <returns> /// a <see cref="T:Northwoods.Go.GoNodeIcon" /> that obeys this node's <see cref="P:Northwoods.Go.GoSimpleNode.MinimumIconSize" /> /// and <see cref="P:Northwoods.Go.GoSimpleNode.MaximumIconSize" /> properties /// </returns> /// <example> /// If you override this method, you may want the definition to do /// some of the things that the standard definition does: /// <code> /// protected virtual GoObject CreateIcon(ResourceManager res, String iconname) { /// if (iconname != null) { /// GoNodeIcon ni = new GoNodeIcon(); /// if (res != null) /// ni.ResourceManager = res; /// ni.Name = iconname; /// ni.MinimumIconSize = new SizeF(20, 20); /// ni.MaximumIconSize = new SizeF(100, 200); /// ni.Size = ni.MinimumIconSize; /// return ni; /// } else { /// GoDrawing rect = new GoDrawing(GoFigure.Rectangle); /// rect.Selectable = false; /// rect.Resizable = false; /// rect.Size = new SizeF(20, 20); /// return rect; /// } /// } /// </code> /// </example> protected virtual GoObject CreateIcon(ResourceManager res, string iconname) { if (iconname != null) { GoNodeIcon goNodeIcon = new GoNodeIcon(); if (res != null) { goNodeIcon.ResourceManager = res; } goNodeIcon.Name = iconname; goNodeIcon.MinimumIconSize = new SizeF(20f, 20f); goNodeIcon.MaximumIconSize = new SizeF(100f, 200f); goNodeIcon.Size = goNodeIcon.MinimumIconSize; return(goNodeIcon); } return(new GoDrawing(GoFigure.Rectangle) { Selectable = false, Resizable = false, Size = new SizeF(20f, 20f) }); }