using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.Drawing;
using
System.Windows.Forms;
namespace
app01_Generate
{
class
Component
{
#region
成员变量定义
public
static
int
OFFSET
=
3
;
public
static
int
HEIGHT
=
98
;
private
int
_weight;
private
int
_index;
private
GroupBox _gb;
private
Label _lb1, _lb2, _lb3;
private
TextBox _tb1, _tb2, _tb3;
private
TableLayoutPanel _tlp;
#endregion
public
Component(
int
index,
int
weight)
{
this
._index
=
index;
this
._weight
=
weight;
this
._gb
=
new
GroupBox();
this
._gb.Location
=
new
Point(
3
, OFFSET
+
this
._index
*
HEIGHT);
this
._gb.Size
=
new
System.Drawing.Size(
this
._weight,
92
);
this
._gb.Anchor
=
((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top
|
System.Windows.Forms.AnchorStyles.Left)
|
System.Windows.Forms.AnchorStyles.Right)));
this
._tlp
=
new
TableLayoutPanel();
this
._tlp.Anchor
=
((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top
|
System.Windows.Forms.AnchorStyles.Bottom)
|
System.Windows.Forms.AnchorStyles.Left)
|
System.Windows.Forms.AnchorStyles.Right)));
this
._tlp.ColumnCount
=
25
;
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.ColumnStyles.Add(
new
System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 4F));
this
._tlp.Location
=
new
System.Drawing.Point(
6
,
20
);
this
._tlp.Name
=
"
_tlp
"
;
this
._tlp.RowCount
=
1
;
this
._tlp.RowStyles.Add(
new
System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this
._tlp.Size
=
new
System.Drawing.Size(
this
._weight
-
12
,
66
);
this
._lb1
=
new
Label();
this
._lb1.Anchor
=
((System.Windows.Forms.AnchorStyles)(( System.Windows.Forms.AnchorStyles.Right)));
this
._lb1.AutoSize
=
true
;
this
._tlp.SetColumnSpan(
this
._lb1,
2
);
this
._lb1.Font
=
new
System.Drawing.Font(
"
微软雅黑
"
,
10.5F
, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((
byte
)(
134
)));
this
._lb1.Location
=
new
System.Drawing.Point((
int
)((
this
._weight
-
12
)
*
8
/
741
),
0
);
this
._lb1.Name
=
"
_lb1
"
;
this
._lb1.Size
=
new
System.Drawing.Size(
47
,
19
);
this
._lb1.Text
=
"
ID
"
;
this
._lb2
=
new
Label();
this
._lb2.Anchor
=
((System.Windows.Forms.AnchorStyles)(( System.Windows.Forms.AnchorStyles.Right)));
this
._lb2.AutoSize
=
true
;
this
._tlp.SetColumnSpan(
this
._lb2,
2
);
this
._lb2.Font
=
new
System.Drawing.Font(
"
微软雅黑
"
,
10.5F
, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((
byte
)(
134
)));
this
._lb2.Location
=
new
System.Drawing.Point((
int
)((
this
._weight
-
12
)
*
124
/
741
),
0
);
this
._lb2.Name
=
"
_lb2
"
;
this
._lb2.Size
=
new
System.Drawing.Size(
47
,
38
);
this
._lb2.Text
=
"
Content
"
;
this
._lb3
=
new
Label();
this
._lb3.Anchor
=
((System.Windows.Forms.AnchorStyles)(( System.Windows.Forms.AnchorStyles.Right)));
this
._lb3.AutoSize
=
true
;
this
._tlp.SetColumnSpan(
this
._lb3,
2
);
this
._lb3.Font
=
new
System.Drawing.Font(
"
微软雅黑
"
,
10.5F
, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((
byte
)(
134
)));
this
._lb3.Location
=
new
System.Drawing.Point((
int
)((
this
._weight
-
12
)
*
501
/
741
),
0
);
this
._lb3.Name
=
"
_lb3
"
;
this
._lb3.Size
=
new
System.Drawing.Size(
47
,
38
);
this
._lb3.Text
=
"
Suggestion
"
;
this
._tb1
=
new
TextBox();
this
._tb1.Anchor
=
((System.Windows.Forms.AnchorStyles)((( System.Windows.Forms.AnchorStyles.Left)
|
System.Windows.Forms.AnchorStyles.Right)));
this
._tlp.SetColumnSpan(
this
._tb1,
2
);
this
._tb1.Font
=
new
System.Drawing.Font(
"
仿宋
"
,
10.5F
, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((
byte
)(
134
)));
this
._tb1.Location
=
new
System.Drawing.Point((
int
)((
this
._weight
-
12
)
*
61
/
741
),
3
);
this
._tb1.Name
=
"
_tb1
"
;
this
._tb1.Size
=
new
System.Drawing.Size(
52
,
29
);
this
._tb2
=
new
TextBox();
this
._tb2.Anchor
=
((System.Windows.Forms.AnchorStyles)((( System.Windows.Forms.AnchorStyles.Left)
|
System.Windows.Forms.AnchorStyles.Right)));
this
._tlp.SetColumnSpan(
this
._tb2,
11
);
this
._tb2.Font
=
new
System.Drawing.Font(
"
仿宋
"
,
10.5F
, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((
byte
)(
134
)));
this
._tb2.Location
=
new
System.Drawing.Point((
int
)((
this
._weight
-
12
)
*
177
/
741
),
3
);
this
._tb2.Multiline
=
true
;
this
._tb2.Name
=
"
_tb2
"
;
this
._tb2.ScrollBars
=
System.Windows.Forms.ScrollBars.Vertical;
this
._tb2.Size
=
new
System.Drawing.Size(
313
,
48
);
this
._tb3
=
new
TextBox();
this
._tb3.Anchor
=
((System.Windows.Forms.AnchorStyles)((( System.Windows.Forms.AnchorStyles.Left)
|
System.Windows.Forms.AnchorStyles.Right)));
this
._tlp.SetColumnSpan(
this
._tb3,
6
);
this
._tb3.Font
=
new
System.Drawing.Font(
"
仿宋
"
,
10.5F
, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((
byte
)(
134
)));
this
._tb3.Location
=
new
System.Drawing.Point((
int
)((
this
._weight
-
12
)
*
554
/
741
),
3
);
this
._tb3.Multiline
=
true
;
this
._tb3.Name
=
"
_tb3
"
;
this
._tb3.ScrollBars
=
System.Windows.Forms.ScrollBars.Vertical;
this
._tb3.Size
=
new
System.Drawing.Size(
184
,
48
);
this
._tlp.Controls.Add(
this
._lb1,
0
,
0
);
this
._tlp.Controls.Add(
this
._tb1,
2
,
0
);
this
._tlp.Controls.Add(
this
._lb2,
4
,
0
);
this
._tlp.Controls.Add(
this
._lb3,
17
,
0
);
this
._tlp.Controls.Add(
this
._tb3,
19
,
0
);
this
._tlp.Controls.Add(
this
._tb2,
6
,
0
);
this
._gb.Controls.Add(
this
._tlp);
}
public
void
addToPanel(
ref
Panel pnl)
{
pnl.Controls.Add(
this
._gb);
}
public
void
Clear()
{
this
._tb1.Clear();
this
._tb2.Clear();
this
._tb3.Clear();
}
public
string
getID()
{
return
this
._tb1.Text.Trim();
}
public
string
getContent()
{
return
this
._tb2.Text.Trim();
}
public
string
getSuggestion()
{
return
this
._tb3.Text.Trim();
}
public
bool
Check()
{
if
(
string
.IsNullOrEmpty(
this
._tb1.Text.Trim())
==
false
||
string
.IsNullOrEmpty(
this
._tb2.Text.Trim())
==
false
||
string
.IsNullOrEmpty(
this
._tb3.Text.Trim())
==
false
)
return
false
;
else
return
true
;
}
public
void
Refresh(
string
id,
string
content,
string
suggestion)
{
this
._tb1.Text
=
id;
this
._tb2.Text
=
content;
this
._tb3.Text
=
suggestion;
}
}
}