G
Guest
Hello you,
I need Your HELP.
I have my own TreeView Nodes Editor, in order to add 'MyTreeNode'', like
node which are ComboBox and so.
I have two classes. one inherit from 'TreeView' and the other from 'TreeNode'.
In 'MyTreeView' i override 'Nodes' (keyword- new) in order to open my custom
editor.
In public partial class MyTreeView : TreeView, I use the next statement:
[
DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
Editor(typeof(NodesTypeEditor), typeof(UITypeEditor)),
]
new public TreeNodeCollection Nodes
{
get { return base.Nodes; }
set
{
TreeNode[] myTreeNodeArray = new
TreeNode[((TreeNodeCollection)value).Count];
((TreeNodeCollection)value).CopyTo(myTreeNodeArray, 0);
((TreeNodeCollection)value).Clear();
this.Nodes.AddRange(myTreeNodeArray);
}
}
but the DesignerSerializationVisibility create the next code, which produce
casting error on run time:
MyCheckTreeNode myCheckTreeNode1 = ((MyCheckTreeNode)(new
TreeNode("TreeNode")));
I need it to be :
MyCheckTreeNode myCheckTreeNode1 = new MyCheckTreeNode("TreeNode");
In the editor i use TreeView and PropertyGrid. the code in 'Add CheckBox
Node' is:
treeView1.Nodes.Add(new MyCheckTreeNode("TreeNode"));
How can i fix it???
Please Help me. I need it fast.
Thanks,
Ran S'
I need Your HELP.
I have my own TreeView Nodes Editor, in order to add 'MyTreeNode'', like
node which are ComboBox and so.
I have two classes. one inherit from 'TreeView' and the other from 'TreeNode'.
In 'MyTreeView' i override 'Nodes' (keyword- new) in order to open my custom
editor.
In public partial class MyTreeView : TreeView, I use the next statement:
[
DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
Editor(typeof(NodesTypeEditor), typeof(UITypeEditor)),
]
new public TreeNodeCollection Nodes
{
get { return base.Nodes; }
set
{
TreeNode[] myTreeNodeArray = new
TreeNode[((TreeNodeCollection)value).Count];
((TreeNodeCollection)value).CopyTo(myTreeNodeArray, 0);
((TreeNodeCollection)value).Clear();
this.Nodes.AddRange(myTreeNodeArray);
}
}
but the DesignerSerializationVisibility create the next code, which produce
casting error on run time:
MyCheckTreeNode myCheckTreeNode1 = ((MyCheckTreeNode)(new
TreeNode("TreeNode")));
I need it to be :
MyCheckTreeNode myCheckTreeNode1 = new MyCheckTreeNode("TreeNode");
In the editor i use TreeView and PropertyGrid. the code in 'Add CheckBox
Node' is:
treeView1.Nodes.Add(new MyCheckTreeNode("TreeNode"));
How can i fix it???
Please Help me. I need it fast.
Thanks,
Ran S'