C# dev SearchLookUpEdit 和 RepositoryItemSearchLookUpEdit 测试
2021-07-15 18:17
标签:hit 数值 reac isp img amp display har abi 一、searchLookUpEdit 绑定数据源 GetSetGridContrl 方法的代码 二、 GridColumn-->RepositoryItemSearchLookUpEdit --> gridView --> C# dev SearchLookUpEdit 和 RepositoryItemSearchLookUpEdit 测试 标签:hit 数值 reac isp img amp display har abi 原文地址:https://www.cnblogs.com/lanyubaicl/p/8940041.html DataTable DtCompany = new DataTable();//数据源表,自己写数据。
searchLookUpEditCus_no.Properties.DataSource = DtCompany;//绑定数据源
GridView gridViewCompany = searchLookUpEdit1View; //获取GridView对象,以配置表格样式
DataTable dtCompanystrc = help.GetDataTableField("tb_Company");//方法:GetDataTableField(),获取数据表:DtCompany的字段,和中文描述
new GridMethod().GetSetGridContrl(dtCompanystrc, gridViewCompany, 35, NameSpacePath + "tb_Company");//配置下来表数据结构
this.searchLookUpEditCus_no.Location = new System.Drawing.Point(54, 38);
this.searchLookUpEditCus_no.Name = "searchLookUpEditCus_no";
this.searchLookUpEditCus_no.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.searchLookUpEditCus_no.Properties.DisplayMember = "CompanyName";
this.searchLookUpEditCus_no.Properties.ValueMember = "CompanyID";
this.searchLookUpEditCus_no.Properties.View = this.searchLookUpEdit1View;
this.searchLookUpEditCus_no.Size = new System.Drawing.Size(146, 20);
this.searchLookUpEditCus_no.TabIndex = 5;
DataTable dtCompanystrc 的数据库表结构
CREATE TABLE [dbo].[TableDetail]
(
[ISID] [int] NOT NULL,
[TableName] [varchar] (30) NOT NULL,
[FileNames] [varchar] (30) NOT NULL,
[FILETYPE] [varchar] (20) NULL,
[SFNULL] [varchar] (1) NULL,
[SFKEY] [varchar] (1) NULL,
[ISIdentity] [varchar] (1) NULL,
[LONG] [int] NULL,
[DEFAULTS] [nvarchar] (100) NULL,
[REM] [nvarchar] (50) NOT NULL,
[REMARK] [nvarchar] (500) NOT NULL,
[Name] [varchar] (50) NULL,
[type2] [varchar] (20) NULL,
[IsEdit] [varchar] (2) NULL CONSTRAINT [DF__TableDeta__IsEdi__4D555BD0] DEFAULT (‘T‘)
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TableDetail] ADD CONSTRAINT [PK__TableDet__5769799B438BFA74] PRIMARY KEY CLUSTERED ([TableName], [FileNames]) ON [PRIMARY]
GO
///
//首列行索引 和 不带百分号的模糊查询 设置
public static void gridView1_CustomDrawRowIndicator(object sender, RowIndicatorCustomDrawEventArgs e)
{
GridView gridView1 = (GridView)sender;
//设置行索引:列索引等于-1处设置行索引。
if (e.Info.IsRowIndicator && e.RowHandle >= 0)
{
e.Info.DisplayText = (e.RowHandle + 1).ToString();
}
//设置筛选行不用输入百分号直接筛选
foreach (DevExpress.XtraGrid.Columns.GridColumn item in gridView1.Columns)
{
item.OptionsFilter.AutoFilterCondition = DevExpress.XtraGrid.Columns.AutoFilterCondition.Contains; //筛选条件设置为包含
}
}
///
///选中行的颜色和背景设置
public void gridView1_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
{
GridView gridView1 = (GridView)sender;
gridView1.Appearance.FocusedRow.ForeColor = Color.Red;//字体颜色
gridView1.Appearance.FocusedRow.BackColor = Color.Linen;//行背景颜色
}
public GridView SearchLookGridView = new GridView ();
SearchLookGridView 添加列
GridColumn ColPRDTYPE = new GridColumn();
ColPRDTYPE.Tag = "PRDTYPE";
ColPRDTYPE.Name = "Col" + "PRDTYPE";
ColPRDTYPE.FieldName = "PRDTYPE";
ColPRDTYPE.Caption = "类型";
ColPRDTYPE.VisibleIndex = 1;
SearchLookGridView.Columns.Add(ColPRDTYPE);
//----------------------
GridColumn ColPRD_NO = new GridColumn();
ColPRD_NO.Tag = "PRD_NO";
ColPRD_NO.Name = "Col" + "PRD_NO";
ColPRD_NO.FieldName = "PRD_NO";
ColPRD_NO.Caption = "产品编号";
ColPRD_NO.VisibleIndex = 2;
SearchLookGridView.Columns.Add(ColPRD_NO);
//----------------------
GridColumn ColBARCODE = new GridColumn();
ColBARCODE.Tag = "BARCODE";
ColBARCODE.Name = "Col" + "BARCODE";
ColBARCODE.FieldName = "BARCODE";
ColBARCODE.Caption = "条形码";
ColBARCODE.VisibleIndex = 3;
SearchLookGridView.Columns.Add(ColBARCODE);
//GridContrl 创建一列
GridColumn gridColumnName = new GridColumn();
//创建对象 下拉 组件对象RepositoryItemSearchLookUpEdit
RepositoryItemSearchLookUpEdit repositoryItemSearchLookUpEdit1 = new RepositoryItemSearchLookUpEdit();
repositoryItemSearchLookUpEdit1.AutoHeight = false;
repositoryItemSearchLookUpEdit1.AutoHeight = false;
repositoryItemSearchLookUpEdit1.Buttons.AddRange(
new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)
}
);
repositoryItemSearchLookUpEdit1.DisplayMember = "PRD_Name";//显示值
repositoryItemSearchLookUpEdit1.Name = "repositoryItemSearchLookUpEdit1";
repositoryItemSearchLookUpEdit1.ValueMember = "PRD_NO";//实际值
repositoryItemSearchLookUpEdit1.View = SearchLookGridView; //下拉框中的表格:Gridview对象
repositoryItemSearchLookUpEdit1.DataSource = DtGoods;//DtGoods数据源对象
//------------------------------------------------------
gridColumnName.Caption = REM;//标题
gridColumnName.ColumnEdit = repositoryItemSearchLookUpEdit1;//绑定下拉控件
gridColumnName.FieldName = FileNames;//设置数据源字段
gridColumnName.Name = "Col" + FileNames;//设置列Name属性
gridColumnName.Visible = true;
gridColumnName.VisibleIndex = i;
//-----------------------------------------------------
gridView1.Columns.Add(gridColumnName);
上一篇:win7下docker配置加速器
文章标题:C# dev SearchLookUpEdit 和 RepositoryItemSearchLookUpEdit 测试
文章链接:http://soscw.com/index.php/essay/105679.html