XPTable的使用方法文档格式.docx
《XPTable的使用方法文档格式.docx》由会员分享,可在线阅读,更多相关《XPTable的使用方法文档格式.docx(8页珍藏版)》请在冰豆网上搜索。
A、在工具箱上点右键选择“添加选项卡〞〔写上自己想写的名字,例如:
第三控件〕,B、再在第三控件
这个选项卡上右键点“选择项〞
在出现的窗体上点浏览,到自己的.dll文件,选择该文件。
〕
如图:
3、将相应三个控件添加到Main窗口里如图:
4、写代码初始化XPTable
如下:
stringtable=this.TableName;
if(string.IsNullOrEmpty(table))return;
DataTabledt=GetDBInfoBLL.GetTBConfiguration(table);
dt.Columns.Remove("
表名"
);
默认值"
主键"
表说明"
字段序号"
dt.Columns.Add("
添加说明"
Type.GetType("
System.String"
));
表头说明"
///选择框添加
CheckBoxColumncheckbox_Add=newCheckBoxColumn("
添加"
80);
///选择框修改
CheckBoxColumncheckbox_Update=newCheckBoxColumn("
修改"
///选择框列表
CheckBoxColumncheckbox_List=newCheckBoxColumn("
列表"
///选择框搜索
CheckBoxColumncheckbox_Search=newCheckBoxColumn("
搜索"
//下拉框
boBoxColumnbobox_search=newboBoxColumn("
搜索类型"
boBoxCellEditorsearchEditor=newboBoxCellEditor();
searchEditor.DropDownStyle=DropDownStyle.DropDownList;
searchEditor.Items.AddRange(newstring[]{"
大于"
"
小于"
等于"
一样"
Other"
});
bobox_search.Editor=searchEditor;
//下拉框验证
boBoxColumnbobox_Verificat=newboBoxColumn("
验证"
100);
boBoxCellEditorVerificatEditor=newboBoxCellEditor();
VerificatEditor.DropDownStyle=DropDownStyle.DropDownList;
VerificatEditor.Items.AddRange(newstring[]{"
不为空"
Classical"
edy"
Rock"
bobox_Verificat.Editor=VerificatEditor;
//字段说明
TextColumntext_name=newTextColumn("
字段"
TextColumntext_desc=newTextColumn("
字段说明"
154);
//字段标识
TextColumntext_Ident=newTextColumn("
标识"
40);
//字段类型
TextColumntext_type=newTextColumn("
类型"
62);
//字段长度
TextColumntext_Length=newTextColumn("
长度"
50);
//字段允许为空
TextColumntext_allowEmpty=newTextColumn("
为空"
//字段添加说明
TextColumntext_addDesc=newTextColumn("
130);
//字段,表头
TextColumntext_tableHeader=newTextColumn("
表头"
this.table.ColumnModel=newColumnModel(newColumn[]{
//字段名
text_name,
//添加选择框
checkbox_Add,
//添加验证下拉框
bobox_Verificat,
//修改选择框
checkbox_Update,
//列表选择框
checkbox_List,
//搜索选择框
checkbox_Search,
//搜索类型下拉框
bobox_search,
//字段说明·
text_desc,
//标识
text_Ident,
//类型
text_type,
//长度
text_Length,
//允许为空
text_allowEmpty,
//添加说明
text_addDesc,
//表头说明
text_tableHeader
//行数
Row[]RowList=newRow[dt.Rows.Count];
for(inti=0;
i&
lt;
dt.Rows.Count;
i++)
{
stringname=dt.Rows[i][0].ToString();
if(string.IsNullOrEmpty(name))continue;
stringfieldDesc=dt.Rows[i][1].ToString();
stringIdent=dt.Rows[i][2].ToString();
//字段类型
stringfieldType=dt.Rows[i][3].ToString();
//字段长度
stringfieldLength=dt.Rows[i][4].ToString();
stringallowEmpty=dt.Rows[i][5].ToString();
stringaddDesc=dt.Rows[i][6].ToString();
stringtableHeader=dt.Rows[i][7].ToString();
Rowr=newRow(newCell[]{
//名称
newCell(name),
newCell(name,true),
newCell("
无"
),
newCell(name,false),
newCell(fieldDesc),
newCell(Ident),
newCell(fieldType),
newCell(fieldLength),
newCell(allowEmpty),
newCell(addDesc),
newCell(tableHeader)
RowList[i]=r;
}
this.table.TableModel=newTableModel(RowList);
this.table.BeginEditing+=newXPTable.Events.CellEditEventHandler(table_BeginEditing);
this.table.TableModel.RowHeight=21;
this.table.EndUpdate();
info.AddDes=this.table.TableModel.Rows[i].Cells[12].Text;
info.TableHeader=this.table.TableModel.Rows[i].Cells[13].Text;
InfoList.Add(info);
小弟用XPTable做的Table截图如下:
InfoList=newList&
CreateInfo&
gt;
();
table.RowCount;
CreateInfoinfo=newCreateInfo();
info.Field=this.table.TableModel.Rows[i].Cells[0].Text;
info.Add=this.table.TableModel.Rows[i].Cells[1].Checked;
info.Verificat=this.table.TableModel.Rows[i].Cells[2].Text;
info.Update=this.table.TableModel.Rows[i].Cells[3].Checked;
info.FieldList=this.table.TableModel.Rows[i].Cells[4].Checked;
info.SearchField=this.table.TableModel.Rows[i].Cells[5].Checked;
info.SearchType=this.table.TableModel.Rows[i].Cells[6].Text;
info.FieldDes=this.table.TableModel.Rows[i].Cells[7].Text;
info.Ident=this.table.TableModel.Rows[i].Cells[8].Text;