daily pastebin goal
42%
SHARE
TWEET

Untitled

a guest Nov 23rd, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // this happens inside class MainForm : Form
  2. x = new X(_node, _nodeList, this, tsLblMessage);
  3.  
  4. // constructor, X
  5. public X(TreeNode node, List<TreeNode> nodeList, Form parentForm, ToolStripStatusLabel tssLabel)
  6. {
  7.     _node = node;
  8.     _nodeList = nodeList;
  9.     _parentForm = parentForm;
  10.     _tssLabel = tssLabel;
  11.  
  12.     _y = new Y(_parentForm, _dataAnalysis, _node)
  13.     {
  14.         Dock = DockStyle.Fill
  15.     };
  16.    
  17.     // This doesn't work
  18.     // _parentForm.Controls.Add(_y);
  19.    
  20.     // This does work, but I don't want MDI
  21.     _form = new Form { MdiParent = _parentForm };
  22.     _form.Controls.Add(_y);
  23.     _form.Show();
  24. }
  25.  
  26. // constructor, Y : UserControl
  27. public Y(Form parentForm, DataAnalysis dataAnalysis, TreeNode node)
  28. {
  29.     InitializeComponent();
  30.  
  31.     _parentForm = parentForm;
  32.     _dataAnalysis = dataAnalysis;
  33.     _node = node;
  34.  
  35.     treeView.Nodes.Add(_node);
  36. }
RAW Paste Data
Top