赞
踩
1.单元格显示时间格式(yyyy/MM/dd HH:mm)
2.pictureEdit 展示图片(点击按钮选中图片,并展示)
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Title = "选择图片文件";
openFileDialog.Filter = "jpg|*.jpg";
openFileDialog.FileName = string.Empty;
openFileDialog.FilterIndex = 1;
openFileDialog.RestoreDirectory = true;
openFileDialog.DefaultExt = "jpg";
DialogResult result = openFileDialog.ShowDialog();
if (result == System.Windows.Forms.DialogResult.Cancel)
{
return;
}
string fileName = openFileDialog.FileName;//获得图片路径
//图片控件展示图片
Bitmap bmPic = new Bitmap(fileName);
Image img = new Bitmap(bmPic, pictureEdit1.Width, pictureEdit1.Height); //指定图片显示尺寸与控件大小一样
pictureEdit1.EditValue = img;
数据库读取展示在pictureEdit:
保存图片至数据库
/// <summary>
/// 图片转二进制
/// </summary>
/// <returns></returns>
private byte[] GetPictureData()
{
FileStream fs = new FileStream(tbPic.Text,FileMode.Open,FileAccess.Read);
byte[] bytes = new byte[fs.Length];
fs.Read(bytes, 0,bytes.Length);
fs.Close();
return bytes;
}
3.GridControl 删除某行信息
int rowIndexDv = this.gridView1.FocusedRowHandle;
int _pk =Convert.ToInt32(this.gridView1.GetRowCellValue(rowIndexDv, "A").ToString());
DateTime _startDate= (DateTime)this.gridView1.GetRowCellValue(rowIndexDv, "B");
int rowIndexDs = -1;
for (int i=0;i< mDsNotamSailD.Tables[0].Rows.Count;i++)
{
if (mDsNotamSailD.Tables[0].Rows[i].RowState == DataRowState.Deleted)
continue;
if (mDsNotamSailD.Tables[0].Rows[i]["NOTAM_PK"].ToString()==_pk.ToString()&& (DateTime)mDsNotamSailD.Tables[0].Rows[i]["START_DATE"]== _startDate)
rowIndexDs = i;
}
if(rowIndexDs>=0) mDsNotamSailD.Tables[0].Rows[rowIndexDs].Delete();
这种写法会删错数据,因为经过排序后控件下标和DataSet中会不同
4.单元格显示时间格式
https://blog.csdn.net/enter89/article/details/46651115
5.控件设置FILL会沾满整个范围盖住其他控件
https://blog.csdn.net/u011695973/article/details/90399728
6.DEV控件devexpress表格控件gridcontrol设置隔行变色、焦点行颜色、设置(改变)显示值、固定列不移动(附源码)
https://www.cnblogs.com/starksoft/p/4936207.html
自定义控件背景色:
System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(178)))), ((int)(((byte)(170)))));
7.打开设计器,找到OptionsView,往下拉设置showGroupPanel为false
8.DEV Grid 获得当前选中行
https://www.cnblogs.com/bwdblogs/p/10059207.html
9.ComboBox的属性Properties.TextEditStyle
为DisableTextEditor,它的意思是让ComboBox的文本显示框不可用,但是选项集合是可选择的
cmbAFir.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
10.DEV ComBox选择项随汉字自动适应:
for (int i = 0; i < mDsSvrDuty.Tables[0].Rows.Count; i++)
{
ComBoxItem itemDuty = new ComBoxItem();
itemDuty.Value = mDsSvrDuty.Tables[0].Rows[i]["DUTY_CODE"].ToString();
itemDuty.Text = mDsSvrDuty.Tables[0].Rows[i]["DUTY_NAME"].ToString();
cobDuty.Properties.Items.Add(itemDuty);
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。