ab56a9bcf7
SVN-Revision: r240
64 lines
2.0 KiB
C#
64 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Windows.Forms;
|
|
using System.Text;
|
|
using System.Reflection;
|
|
using System.Drawing;
|
|
using NewMyFormDesigner.Core;
|
|
using NewMyFormDesigner;
|
|
|
|
namespace NewMyFormDesigner
|
|
{
|
|
class ControlHelper
|
|
{
|
|
public static Control CreateControl(string userName, string ctrName, int fileTypeId)
|
|
{
|
|
try
|
|
{
|
|
Control ctrl = null;
|
|
switch (fileTypeId)
|
|
{
|
|
case 8888:
|
|
ctrl = new LabelGroupBox();
|
|
ctrl.Name = userName;
|
|
ctrl.Tag = 8888;
|
|
ctrl.Text = "分组名称";
|
|
break;
|
|
case 8889:
|
|
ctrl = new Panel();
|
|
ctrl.Name = userName;
|
|
ctrl.Tag = 8889;
|
|
ctrl.BackColor = Color.LightGreen;
|
|
ctrl.Height = 24;
|
|
ctrl.Width = 100;
|
|
ctrl.Text = "分页名称";
|
|
break;
|
|
case 8890:
|
|
ctrl = new LabelDivider();
|
|
ctrl.Name = userName;
|
|
ctrl.Tag = 8890;
|
|
ctrl.BackColor = Color.LightGreen;
|
|
ctrl.Height = 2;
|
|
ctrl.Width = 200;
|
|
ctrl.Text = "分割线";
|
|
break;
|
|
default:
|
|
ctrl = new LabelTextEx();
|
|
(ctrl as LabelTextEx).LabelText = userName;
|
|
break;
|
|
}
|
|
if (ctrl != null)
|
|
{
|
|
ctrl.Name = ctrName;
|
|
}
|
|
return ctrl;
|
|
}
|
|
catch (Exception ex) //创建失败
|
|
{
|
|
MessageBox.Show(ex.Message);
|
|
return new Control();
|
|
}
|
|
}
|
|
}
|
|
}
|