devexpress
有谁能提供一些 devexpress组件的用法,最好有视频,呵呵,谢谢了,最好有cxgrid的详细介绍哦 --------------------编程问答-------------------- 怎么给你呢?
--------------------编程问答-------------------- 可以发到我的邮箱吗,451290601@qq.com 谢谢了
呵呵 --------------------编程问答-------------------- --------------------编程问答-------------------- 设置行号
gridView1.IndicatorWidth = 30;
private void gridView1_CustomDrawRowIndicator_1(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
{
e.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far;
if (e.Info.IsRowIndicator)
{
if (e.RowHandle >= 0)
{
e.Info.DisplayText = (e.RowHandle + 1).ToString();
}
else if (e.RowHandle < 0 && e.RowHandle > -1000)
{
e.Info.Appearance.BackColor = System.Drawing.Color.AntiqueWhite;
e.Info.DisplayText = "G" + e.RowHandle.ToString();
}
}
}
private void gridView1_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
{
if (e.Info.IsRowIndicator && e.RowHandle >= 0)
{
e.Info.DisplayText = e.RowHandle.ToString();
}
}
隐藏图中标记处的英文部分
代码实现方法
gridView1.OptionsView.ShowGroupPanel = false;
控件实现方法
设置某列不可编辑和只读
gridView1.Columns[0].OptionsColumn.AllowEdit = false;
gridView1.Columns[0].OptionsColumn.ReadOnly = false;
设置模板
以下为步骤
首先从In-Place Editor Repository中添加LookUpEdit.取名为re_User
他的Columns属性中添加2列.Caption依次为:编号,姓名FieldName依次为:User_code,User_Name然后将Re1的NullText设置成空.
AutoSearchColumnIndex属性设置为2.
ImmediatePopup属性设置为True.
SearchMode设置为OnlyInPopup.
然后将这个模板列附加到我们上面提到的列1(也就是将列1的ColumnEdit属性设成Re1)
最后我们还要在代码里面给Re1绑定数据源和显示项.
re_user.DataSource=new T8002().getT8002().Tables[0];
re_user.DisplayMember = "USER_NAME";
re_user.ValueMember = "USER_CODE";
*:对于Oracle数据库字段一定要用大写,切记!!
Dev中的属性Table
/// <summary>
/// 机场图管理表的状态
/// </summary>
/// <returns></returns>
public DataTable TypeTable()
{
DataTable dt = new DataTable();
dt.Columns.Add("S_TYPE");
dt.Columns.Add("S_TYPE_NAME");
DataRow row = dt.NewRow();
row["S_TYPE"] = "0";
row["S_TYPE_NAME"] = "正常";
dt.Rows.Add(row);
row = dt.NewRow();
row["S_TYPE"] = "1";
row["S_TYPE_NAME"] = "删除";
dt.Rows.Add(row);
return dt;
}
使新添加的行在 gridView1 的第一行
//使新添加的行在 gridView1 的第一行
gridView1.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.Top;
gridView1.AddNewRow();
初始化新行的数据
private void gridView1_InitNewRow(object sender, DevExpress.XtraGrid.Views.Grid.InitNewRowEventArgs e)
{
ColumnView View = sender as ColumnView;
View.SetRowCellValue(e.RowHandle, "SEQ_I7101", (int)DataSetProvider.GetSequenceSeed("seq_i7101"));
View.SetRowCellValue(e.RowHandle, "S_TYPE", "0");
}
子窗体字段刷新父窗体(注意加大加粗字体部分)
父窗体
private void btnAdd_Click(object sender, EventArgs e)
{
FrmBaseInfo_img_01 frm = new FrmBaseInfo_img_01();
if (frm.ShowDialog() == DialogResult.OK)
{
if (dt.Select("I7101='" + frm.ID + "'").Length > 0)
{
dt.Select("I7101='" + frm.ID + "'")[0]["AIRPORT_4CODE"] = frm.CODE;
dt.Select("I7101='" + frm.ID + "'")[0]["PIC_CODE"] = frm.PIC_CODE;
dt.Select("I7101='" + frm.ID + "'")[0]["PUBLISH_DATE"] = frm.Publish_date;
dt.Select("I7101='" + frm.ID + "'")[0]["EFFECT_DATE"] = frm.EFFECT_DATE;
dt.Select("I7101='" + frm.ID + "'")[0]["USER_CODE"] = frm.UserCODE;
dt.Select("I7101='" + frm.ID + "'")[0]["MAKE_DATE"] = frm.Mark_Date;
dt.Select("I7101='" + frm.ID + "'")[0]["S_TYPE"] = "0";
}
else
{
try
{
DataRow _dr = dt.NewRow();
_dr["I7101"] = frm.ID;
_dr["AIRPORT_4CODE"] = frm.CODE;
_dr["PIC_CODE"] = frm.PIC_CODE;
_dr["PUBLISH_DATE"] = frm.Publish_date;
_dr["EFFECT_DATE"] = frm.EFFECT_DATE;
_dr["USER_CODE"] = frm.UserCODE;
_dr["MAKE_DATE"] = frm.Mark_Date;
_dr["S_TYPE"] = "0";
dt.Rows.Add(_dr);
}
catch (Exception)
{
MessageBox.Show("请您正确填写日期的格式");
}
}
gvImg.Refresh();
}
}
子窗体
获取选中行指定列的值
注意: gcUSER_CODE 为需要获取的列,可根据实际需求改动
--------------------编程问答-------------------- 好东西,回去好好研究,谢谢这位大侠 --------------------编程问答-------------------- 好东西,回去好好研究,谢谢这位大侠 --------------------编程问答-------------------- 我的代码有什么错误啊,问什么room表的显示就不能自定义标题呢
--------------------编程问答-------------------- 我记得安装程序带了很多例子,默认安装没有打钩,供参考 --------------------编程问答-------------------- --------------------编程问答-------------------- 界个 应该属于第三方控件吧。 --------------------编程问答-------------------- 貌似需要 安装好后 再加载吧。 --------------------编程问答-------------------- 除 --------------------编程问答--------------------
DataSet ds = new DataSet();
ds.Tables.Add(VirtualDataSourceBuilding());
ds.Tables.Add(VirtualDataSourceFloor());
ds.Tables.Add(VirtualDataSourceRoom());
//设置栋座表和楼层表之间的关系
DataColumn keyColumnBuilding = ds.Tables["BuildingInfo"].Columns["id"];
DataColumn foreignKeyColumnFloor = ds.Tables["floor"].Columns["buildingID"];
ds.Relations.Add("buildingFloor", keyColumnBuilding, foreignKeyColumnFloor,false);
//设置楼层表和房间表之间的关系
DataColumn keyColumnFoor = ds.Tables["floor"].Columns["id"];
DataColumn foreignKeyColumnRoom = ds.Tables["room"].Columns["floorID"];
ds.Relations.Add("floorRoom", keyColumnFoor, foreignKeyColumnRoom, false);
//给GridControl绑定数据源
gridControl1.DataSource = ds.Tables["buildingInfo"];
gridControl1.ForceInitialize();
//Assign a GridView to the relationship
DevExpress.XtraGrid.Views.Grid.GridView gvFloor = new DevExpress.XtraGrid.Views.Grid.GridView(gridControl1);
gridControl1.LevelTree.Nodes.Add("buildingFloor", gvFloor);
DevExpress.XtraGrid.Views.Grid.GridView gvRoom = new DevExpress.XtraGrid.Views.Grid.GridView(gridControl1);
DevExpress.XtraGrid.Columns.GridColumn columnRoomID = new DevExpress.XtraGrid.Columns.GridColumn();
columnRoomID.FieldName = "roomID";
columnRoomID.Name = "columnRoomID";
columnRoomID.Caption = "房间编号";
DevExpress.XtraGrid.Columns.GridColumn columnFloorID = new DevExpress.XtraGrid.Columns.GridColumn();
columnFloorID.FieldName = "floorID";
columnFloorID.Name = "columnFloorID";
columnFloorID.Caption = "楼层编号";
DevExpress.XtraGrid.Columns.GridColumn columnRoomName = new DevExpress.XtraGrid.Columns.GridColumn();
columnRoomName.FieldName = "roomName";
columnRoomName.Name = "columnRoomName";
columnRoomName.Caption = "房间名称";
gvRoom.Columns.Add(columnRoomID);
gvRoom.Columns.Add(columnFloorID);
gvRoom.Columns.Add(columnRoomName);
gridControl1.LevelTree.Nodes.Add("floorRoom", gvRoom);
gvBuilding.Columns["id"].VisibleIndex = 1;
gvBuilding.Columns["buildingName"].Caption = "栋座名称";
gvBuilding.Columns["ruleName"].Caption = "栋座规则";
gvBuilding.Columns["floorsCount"].Caption = "楼层数";
//Create columns for the pattern view
gvFloor.PopulateColumns(ds.Tables["floor"]);
gvFloor.Columns["floorName"].Caption = "楼层名称";
gvFloor.Columns["property"].Caption = "楼层属性";
gvFloor.Columns["buildingID"].VisibleIndex = 1;
//Set a predefined color scheme for the Card View
//Color schemes are stored in the Windows\System32 folder by default
//in the DevExpress.XtraGrid.Appearances.xml file
string filePath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.System) +
"\\DevExpress.XtraGrid.Appearances.xml";
XAppearances xAppearances = new XAppearances(filePath);
xAppearances.LoadScheme("Winter", gvFloor);
gvFloor.PaintStyleName = "MixedXP";
xAppearances.LoadScheme("Winter", gvBuilding);
gvBuilding.PaintStyleName = "MixedXP";
this.gvBuilding.OptionsView.ShowGroupPanel = false;
gvFloor.OptionsView.ShowGroupPanel = false;
//禁止删除列
gvBuilding.OptionsCustomization.AllowColumnMoving = false;
gvFloor.OptionsCustomization.AllowColumnMoving = false;
//禁止添加行
gvBuilding.OptionsBehavior.AllowAddRows = DevExpress.Utils.DefaultBoolean.False;
gvFloor.OptionsBehavior.AllowAddRows = DevExpress.Utils.DefaultBoolean.False;
//设置标题
gvBuilding.ViewCaption = "栋座信息";
gvFloor.ViewCaption = "楼层信息";
gvRoom.ViewCaption = "房号信息";
你安装了devexpress以后本地会有 一个 程序是 Demo center。
这个里面的案例一应俱全。前后台都有 --------------------编程问答-------------------- --------------------编程问答-------------------- 除 --------------------编程问答-------------------- 除
补充:.NET技术 , 其他语言