Ruslan,
Thanks for the quick response.
Essentially what I'm saying is that the assignment of any of the higher level nodes results in a blank node image, node state or not it won't seem to display anything into those higher level nodes, I know this because I've confirmed it is loading the image into the node just not displaying it. The node image states are really a separate issue which I was asking for an explanation on what the best implementation methodology was for that function.
The example I gave didn't include that.
The BaseNodeEx class is as follows:
/// <summary>
/// Base extended node class (derived from NodeWithImage). The Type property is set to Image by default.
/// </summary>
public class BaseNodeEx : NodeWithImage
{
Bitmap _icon;
NodeType _type = NodeType.Image;
public BaseNodeEx()
: base()
{
}
public BaseNodeEx(string text)
: base(text)
{
}
public BaseNodeEx(string text, Bitmap icon)
: base(text)
{
_icon = icon;
}
public Bitmap Icon
{ get { return _icon; } set { _icon = value; } }
public NodeType Type
{
get { return _type; }
set { _type = value; }
}
public enum NodeType
{
Batch,
Document,
Image
}
}MainTreeView, nodeIMG, nodeTextBox Design Definitions
private ARMSoft.FlexibleTreeView.FlexibleTreeView MainTreeView;
private ARMSoft.FlexibleTreeView.NodeControls.NodeImage nodeIMG;
private ARMSoft.FlexibleTreeView.NodeControls.NodeTextBox nodeTextBox;
//
// MainTreeView
//
this.MainTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.MainTreeView.DragDropOptions.AllowDrag = true;
this.MainTreeView.DragDropOptions.AllowDrop = true;
this.MainTreeView.DragDropOptions.DropMarkColor = System.Drawing.Color.FromArgb(((int)(((byte)(215)))), ((int)(((byte)(227)))), ((int)(((byte)(188)))));
this.MainTreeView.FocusedNodeStyle.FocusRectShift = 4;
this.MainTreeView.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.MainTreeView.Location = new System.Drawing.Point(12, 180);
this.MainTreeView.Name = "MainTreeView";
this.MainTreeView.NodeControls.Add(this.nodeIMG);
this.MainTreeView.NodeControls.Add(this.nodeTextBox);
this.MainTreeView.Options.Appearance.AntiAlias = true;
this.MainTreeView.Options.Appearance.GrayscaleWhenDisabled = true;
this.MainTreeView.Options.Appearance.ShowHorzLines = true;
this.MainTreeView.Options.Selection.AllowEmptySelection = false;
this.MainTreeView.Options.Selection.HighlightMode = ARMSoft.FlexibleTreeView.eNodeHighlightMode.ContentOnly;
this.MainTreeView.Options.Selection.HoverStyle = ARMSoft.FlexibleTreeView.eHoverStyle.SoftSelect;
this.MainTreeView.Options.Selection.SelectionMode = ARMSoft.FlexibleTreeView.eNodeSelectionMode.MultiSameLevel;
this.MainTreeView.Options.Selection.ValidateNodeSelection = true;
this.MainTreeView.Padding = new System.Windows.Forms.Padding(4);
this.MainTreeView.PreferredNodeHeight = 150;
this.MainTreeView.Size = new System.Drawing.Size(284, 527);
this.MainTreeView.TabIndex = 4;
this.MainTreeView.DragDrop += new System.Windows.Forms.DragEventHandler(this.MainTreeView_DragDrop);
this.MainTreeView.DragOver += new System.Windows.Forms.DragEventHandler(this.MainTreeView_DragOver);
this.MainTreeView.MouseClick += new System.Windows.Forms.MouseEventHandler(this.MainTreeView_MouseClick);
//
// nodeIMG
//
this.nodeIMG.UseStateImages = true;
//
// nodeTextBox
//
this.nodeTextBox.ContentAlign = System.Drawing.ContentAlignment.BottomCenter;
this.nodeTextBox.Sortable = false;So that is my fault for not being more clear there are actually two issues here.
- What might be causing the behavior where an image can not be loaded into a higher level node?
- What is the best way to implement a different node image for the different states.
Let me also qualify all of this with the fact that I've found that with even using the base NodeWithImage class I can not seem to have the image load and display in the tree view unless the image is assigned when a class instance is created, is this the expected behavior? I also found that if I didn't declare a NodeWithImage (nodeIMG) object which is instantiated via the InitializeComponent() start up method the images will not display in the tree view.
Thanks again.
Visual Studio 2010 - 10.0.30319.1