Custom control not passing properties and events to parent

G

Guest

I have a custom control consisting of a panel, a text label, and a TreeView
derived from Microsoft's TreeView control modified to allow custom paint
events. The text label is contained inside the panel, which is docked at the
top of my custom control; the treeview is docked to fill the remainder of the
custom control.

If I declare the public class to inherit System.Windows.Forms.UserControl,
resize events for the custom control pass down to resize the treeview and the
panel; however, I'm unable to assign any node values to the tree. If I
declare the public class to inherit from my modified treeview control, I'm
able to populate the tree; however, the contents aren't visible nor do resize
events have any impact on the treeview or the panel.

Any ideas on how I can get this working? Thanks in advance!

Allen
 
G

Guest

I've gone back and removed the docking for the modified TreeView control in
my custom control and handle the sizing of it in the Resize event for the
custom control. That takes care of part of the problem, but not all.

Setting a breakpoint in my application to stop program execution, I'm able
to add nodes via the Command Window by issuing a statement such as
'SourceTreeView.treeView1.Nodes.Add("parent")'. Continuing execution of the
program, the new node is displayed in the tree. However, I'm unable to
compile the application if I programmatically add nodes during the Form_Load
event using the same statement; instead, I'm getting an error message stating
that SourceTreeView.treeView1 is inaccessible due to its protection level.
How do I get around this problem? Thanks! :)

Allen
 
G

Guest

I am trying to customize the TreeView Paint method to get the text nodes to
wrap instead of causing a horizontal scroll bar. By any chance, could I look
at the code that you developed the custom TreeView with? Any help would be
greatly appreciated. Thankx! fuul
 
G

Guest

There really isn't much to the code...at least nothing that'd help with what
you are trying to do. All I needed to do is populate the tree and be able to
know which node was selected, so I simply dropped the TreeView into a
container along with the previously mentioned label. The label simply acts
as a header for the tree. I don't know of any method of forcing the TreeView
control to perform wordwrapping. Best of luck with it!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top