示例#1
0
 private void createView(PssgNode node)
 {
     // Determine if we need a DataGridView or a RichTextBox based on data to be displayed
     dataGridView.Rows.Clear();
     dataGridView.TopLeftHeaderCell.Value = node.Name;
     int i = 0;
     foreach (PssgAttribute pair in node.Attributes)
     {
         dataGridView.Rows.Add(pair.Value);
         dataGridView.Rows[i].HeaderCell.Value = pair.Name;
         dataGridView.Rows[i].Cells[0].ValueType = pair.ValueType;
         dataGridView.Rows[i].Tag = pair;
         i++;
     }
     dataGridView.Tag = node;
     dataGridView.BringToFront();
     if (node.IsDataNode)
     {
         richTextBox1.Text = node.ToString();//EndianBitConverter.ToString(node.data);
         richTextBox1.Visible = true;
         if (node.Attributes.Count == 0)
         {
             richTextBox1.Dock = DockStyle.Fill;
             richTextBox1.BringToFront();
         }
         else
         {
             richTextBox1.Dock = DockStyle.Bottom;
             richTextBox1.Size = new System.Drawing.Size(richTextBox1.Size.Width, 214);
             dataGridView.BringToFront();
         }
     }
     else
     {
         richTextBox1.Visible = false;
     }
 }