Ken H

Ken H

  • NA
  • 646
  • 360.5k

How to achieve multilabel form in c# winform?

Dec 7 2014 9:32 AM
Hi all,
 
       Detailed description of the problem as follows:
 
--SQL Server script:
CREATE TABLE forms_config
(
id int,
namespace_name varchar(50),
class_name varchar(50)
)
 
//  C# codes:
namespace MulLableForms
{
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
treeView1.Nodes.Add("Main Menu");
treeView1.Nodes[0].Nodes.Add("Submenu one");
treeView1.Nodes[0].Nodes[0].Nodes.Add("Form2");
treeView1.Nodes[0].Nodes[0].Nodes.Add("Form3");
treeView1.Nodes[0].Nodes[0].Nodes.Add("Form4");
treeView1.Nodes[0].Nodes.Add("Submenu two");
treeView1.Nodes[0].Nodes[1].Nodes.Add("Form5");
treeView1.Nodes[0].Nodes[1].Nodes.Add("Form6");
}
private void treeView1_DoubleClick(object sender, EventArgs e)
{
string formName = treeView1.SelectedNode.Text.Trim();
string queryFormConfig = @"select namespace_name,class_name from forms_config where class_name='" + formName+"'";
/*
Now,When I need to double-click the node to load the specified node form, and docked on the right side of the menu.
* When I double-click the node to continue, and continue to stop at the right of the menu. Thereby forming a multi-label style. It looks like SQL Server style.
* Description: use the reflective technology to dynamically load the specified form.
* Reflection parameters are stored in 'forms_config'.
* How to do this?
*/
}

 
Thanks. 

Answers (8)