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.


VulpesRank #55 · 29.2K reputationPosted Dec 7, 2014, 11:43 AM EST
VulpesRank #55 · 29.2K reputationPosted Jan 30, 2015, 12:36 PM EST
http://www.dotnetthoughts.net/implementing-close-button-in-tab-pages/
Ken HRank #2,315 · 610 reputationPosted Dec 7, 2014, 10:29 PM EST
How to achieve the effect of tabs?
such as:each tab that represents a form.It looks like Microsoft SQL Server Managerment Studio style.
Renderings :
Thank for you.
VulpesRank #55 · 29.2K reputationPosted Dec 8, 2014, 5:48 AM EST
If you do, then it would be better to use UserControls rather than Forms as it is much easier to embed the former in tab pages.
Can I also point out that, as you're using reflection, performance is not going to be great whatever you do. To improve matters, you could cache each Form or UserControl object as you create it so you don't have to create a new object of the same class each time it's selected.
Ken HRank #2,315 · 610 reputationPosted Dec 8, 2014, 3:47 PM EST
Of course, your idea is very good.You can write a sample procedure?
thank for you.
VulpesRank #55 · 29.2K reputationPosted Dec 10, 2014, 1:40 PM EST
Here's some code which adds a new TabPage to a TabControl for each reflection-created form. It doesn't allow you to add the same form more than once.
You'll need, of course, to make sure that the size of your forms and the size of the tab pages are compatible with each other:
Ken HRank #2,315 · 610 reputationPosted Jan 29, 2015, 3:53 PM EST
You are correct. Thank for your solution. :)
In addition,How to in each label embedded close icon?
It looks like this:
That would be more perfect.
Ken HRank #2,315 · 610 reputationPosted Feb 1, 2015, 4:35 PM EST