对于devexpress gridview 内插图加加进度条等的一点解读

如上图,gategory 加了小图标, 其他行内还有计算器,大图片 进度条等
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data; namespace DevExpress.XtraEditors.Demos {
/// <summary>
/// Summary description for MultiEditors.
/// </summary>
public partial class MultiEditors : TutorialControl {
public MultiEditors() {
//
// Required for Windows Form Designer support
//
InitializeComponent();
//TutorialInfo.WhatsThisCodeFile = "CS\\GridMainDemo\\Modules\\MultiEditors.cs";
//TutorialInfo.WhatsThisXMLFile = "DevExpress.XtraEditors.Demos.CodeInfo.MultiEditors.xml";
gridControl1.ForceInitialize();
InitData();
//
// TODO: Add any constructor code after InitializeComponent call
//
} #region Init
private Image GetImage(string name) {
System.IO.Stream str = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("DevExpress.XtraEditors.Demos.Images." + name);
if (str != null)
return Bitmap.FromStream(str);
return null;
} private byte[] ImageToByteArray(Image image) {
System.IO.MemoryStream mStream = new System.IO.MemoryStream();
image.Save(mStream, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] ret = mStream.ToArray();
mStream.Close();
return ret;
}
private void InitData() {
RecordOrder[] records = new RecordOrder[];
records[] = new RecordOrder(Properties.Resources.ProductName, "Mishi Kobe Niku", "Teatime Chocolate Biscuits", "Ipoh Coffee"); //第一行纯字符串
records[] = new RecordOrder(Properties.Resources.Category, , , ); //第二行带小图标 后边的 6 3 1 是imagelist 控件添加进去 的小图标的顺序号 .从1开始.
records[] = new RecordOrder(Properties.Resources.Supplier, "Tokyo Traders", "Specialty Biscuits, Ltd.", "Leka Trading");
records[] = new RecordOrder(Properties.Resources.QuantityPerUnit, "18 - 500 g pkgs.", "10 boxes x 12 pieces", "16 - 500 g tins");
records[] = new RecordOrder(Properties.Resources.UnitPrice, 97.00, 9.20, 46.00);
records[] = new RecordOrder(Properties.Resources.UnitsInStock, , , );
records[] = new RecordOrder(Properties.Resources.Discontinued, false, true, true);
records[] = new RecordOrder(Properties.Resources.LastOrder, new DateTime(, , ), new DateTime(, , ), new DateTime(, , ));
records[] = new RecordOrder(Properties.Resources.Picture, Properties.Resources.product1, Properties.Resources.product2, Properties.Resources.product3);
records[] = new RecordOrder(Properties.Resources.Relevance, , , ); gridControl1.DataSource = records;
}
#endregion
#region Grid events
//<gridControl1>
// Properties.Resources.Category 此处用了属性资源字符串
gridView1_CustomRowCellEdit 是指定格子里的按钮等控件 比如repositoryItemImageComboBox1 是通过repository 入口进行设置
private void gridView1_CustomRowCellEdit(object sender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs e) {
if (e.Column.FieldName != "Category") {
RecordOrder rec = gridView1.GetRow(e.RowHandle) as RecordOrder;
if (rec.Category == Properties.Resources.Category) e.RepositoryItem = repositoryItemImageComboBox1;
if (rec.Category == Properties.Resources.Supplier) e.RepositoryItem = repositoryItemComboBox1;
if (rec.Category == Properties.Resources.UnitPrice) e.RepositoryItem = repositoryItemCalcEdit1;
if (rec.Category == Properties.Resources.UnitsInStock) e.RepositoryItem = repositoryItemSpinEdit1;
if (rec.Category == Properties.Resources.Discontinued) e.RepositoryItem = repositoryItemCheckEdit1;
if (rec.Category == Properties.Resources.Discontinued) e.RepositoryItem = repositoryItemCheckEdit1;
if (rec.Category == Properties.Resources.LastOrder) e.RepositoryItem = repositoryItemDateEdit1;
if (rec.Category == Properties.Resources.Picture) e.RepositoryItem = repositoryItemPictureEdit1;
if (rec.Category == Properties.Resources.Relevance) e.RepositoryItem = repositoryItemProgressBar1;
}
}
//</gridControl1>
private void gridView1_RowCellDefaultAlignment(object sender, DevExpress.XtraGrid.Views.Base.RowCellAlignmentEventArgs e) {
if (e.Column.FieldName != "Category") {
if (e.RowHandle == || e.RowHandle == )
e.HorzAlignment = DevExpress.Utils.HorzAlignment.Far;
if (e.RowHandle == )
e.HorzAlignment = DevExpress.Utils.HorzAlignment.Center;
}
}
//<gridControl1>
/*
~Set custom height for row 8:
*/
private void gridView1_CalcRowHeight(object sender, DevExpress.XtraGrid.Views.Grid.RowHeightEventArgs e) {
if (e.RowHandle == ) e.RowHeight = ;
}
//</gridControl1>
#endregion
#region RepositoryItems events
private void repositoryItemProgressBar1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) {
int i = ;
if (gridView1.ActiveEditor == null) return;
if (e.KeyChar == '+') {
i = (int)gridView1.ActiveEditor.EditValue;
if (i < )
gridView1.ActiveEditor.EditValue = i + ;
}
if (e.KeyChar == '-') {
i = (int)gridView1.ActiveEditor.EditValue;
if (i > )
gridView1.ActiveEditor.EditValue = i - ;
}
}
#endregion
}
}
using System;
namespace DevExpress.XtraEditors.Demos {
public class RecordOrder {
private string fcategory;
private object fproduct1;
private object fproduct2;
private object fproduct3; public RecordOrder(string fcategory, object fproduct1, object fproduct2, object fproduct3) {
this.fcategory = fcategory;
this.fproduct1 = fproduct1;
this.fproduct2 = fproduct2;
this.fproduct3 = fproduct3;
} public string Category {
get { return fcategory; }
} public object Product1 {
get { return fproduct1; }
set { fproduct1 = value; }
} public object Product2 {
get { return fproduct2; }
set { fproduct2 = value; }
} public object Product3 {
get { return fproduct3; }
set { fproduct3 = value; }
}
}
}
对于devexpress gridview 内插图加加进度条等的一点解读的更多相关文章
- DevExpress GridControl 单元格添加进度条(ProgressBar)
首先可以使用DevExpress GridControl 自带的进度条控件. 但是我要用一个方法来设置所以的单元格进度,而不是每个单元格都要设置一遍,同时我想要根据进度值不同,进度条显示不同的颜色. ...
- jquery 实现拖动文件上传加进度条
通过对文件的拖动实现文件的上传,主要用到的是HTML5的ondrop事件,上传内容通道FormData传输: //进度条 <div class="parent-dlg" &g ...
- easyui datagrid 单元格加进度条(亲测可用)
{field: 'DataItemNum', title: '数据完整度', width: 100, formatter: function (v, r, i) { var p = (v / 27) ...
- layui 文件上传加进度条
1.页面 <div class="layui-row layui-col-space5"> <div class="layui-form-item&qu ...
- 微信小程序-上传多张图片加进度条(支持预览、删除)
2018-12-24 详情示例见:https://www.cnblogs.com/cisum/p/9564898.html 2018-12-29 组件下载见:https://www.cnblogs.c ...
- Js异步上传加进度条
http://www.ruanyifeng.com/blog/2012/09/xmlhttprequest_level_2.html http://www.cnblogs.com/yuanlong10 ...
- 纯H5 AJAX文件上传加进度条功能
上传代码js部分 //包上传 $('.up_apk').change(function () { var obj = $(this); var form_data = new FormData(); ...
- 在DevExpress GridControl中添加进度条控件 z
首先可以使用 DevExpress GridControl 自带的进度条控件. 但是我要用一个方法来设置所有的单元格进度,而不是每个单元格都要设置一遍,同时我想要根据进度值不同,进度条显示不同的颜色. ...
- 关于JFace中的进度条对话框(ProgressMonitorDialog类)
在Windows操作系统中,最常用的进度条对话框就是文件复制时的弹出框,如果想让用户愉快的使用你开发 的软件,那么在执行某个较长时间的操作时候,就应该弹出一个进度条提示框,告诉用户程序正在做什么. 做 ...
随机推荐
- Windows组件下载地址
Windows下载中心 http://www.microsoft.com/zh-cn/download/default.aspx IE10下载地址 http://www.microsoft.com/z ...
- debug.keystare找不到的解决办法[转]
重装系统之后,丢失了debug.keystore,找了很久都没有找到,根据网上所讲的只要重新运行一个android项目;就会在avd中生成一个新的debug.keystroe,此法也没解决,索性直接重 ...
- hive 安装centos7
wget mirror.bit.edu.cn/apache/hive/hive-2.3.4/apache-hive-2.3.4-bin.tar.gz 解压到/usr/local/apache-hive ...
- OpenCV SVM
#include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <ope ...
- C++访问二维数组元素
if(*image_in+j*+xsize+i)>=thresh)//xsize图像宽度 image_out是首地址,加上j*行宽就是目标行的首地址,再加上i,就是在此行中的第i个像素,所以整个 ...
- 03_java基础(四)之方法的创建与调用
import org.junit.Test; public class Main { public static void main(String[] args) { System.out.print ...
- 联想电脑 Wifi开关开不了
"VirtualBox Host-Only Network" 没有有效的IP配置 未修复 自己电脑显示 控制面板>网络和Internet>网络连接 VirtualBo ...
- Binary Logging Formats
[Binary Logging Formats] The server uses several logging formats to record information in the binary ...
- cdh5.13.1 升/降级SPARK2 (parcel安装的同理)
下载相关的CSD包与parcel包.parcel包SHA 放置在相关位置. 注意:重启cloudera-scm-server 从parcel 里删除旧包,启用新包 csd目录里其它JAR包要删除
- 20. Valid Parentheses (Stack)
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the inpu ...