当前位置: 首页 > news >正文

威海网站建设兼职家居seo整站优化方案

威海网站建设兼职,家居seo整站优化方案,南京建设主管部门网站,广东seo推广贵不贵背景#xff1a;最近在项目中有需求需要在DataGridView中添加“删除”、“修改”按钮#xff0c;用来对数据的操作以及显示。 在DataGridView中显示需要的按钮 首先在DataGridView中添加需要的列#xff0c;此列是用来存放按钮的。 然后在代码中“画”按钮。 if (e.Column…背景最近在项目中有需求需要在DataGridView中添加“删除”、“修改”按钮用来对数据的操作以及显示。 在DataGridView中显示需要的按钮 首先在DataGridView中添加需要的列此列是用来存放按钮的。 然后在代码中“画”按钮。 if (e.ColumnIndex 0 e.RowIndex 0){if (this.dgvwProdCode.Columns[e.ColumnIndex].Name act){StringFormat sf StringFormat.GenericDefault.Clone() as StringFormat;//设置重绘入单元格的字体样式sf.FormatFlags StringFormatFlags.DisplayFormatControl;sf.Alignment StringAlignment.Center;sf.LineAlignment StringAlignment.Center;sf.Trimming StringTrimming.EllipsisCharacter;e.PaintBackground(e.CellBounds, true);//重绘边框//设置要写入字体的大小System.Drawing.Font myFont new System.Drawing.Font(微软雅黑, 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));SizeF sizeDel e.Graphics.MeasureString(删除, myFont);SizeF sizeMod e.Graphics.MeasureString(修改, myFont);SizeF sizeIsEnable e.Graphics.MeasureString(启用/禁用, myFont);float fDel sizeDel.Width / (sizeDel.Width sizeMod.Width sizeIsEnable.Width); //float fMod sizeMod.Width / (sizeDel.Width sizeMod.Width sizeIsEnable.Width);float fIsEnable sizeIsEnable.Width / (sizeDel.Width sizeMod.Width sizeIsEnable.Width);//设置每个“按钮的边界”RectangleF rectDel new RectangleF(e.CellBounds.Left, e.CellBounds.Top, e.CellBounds.Width * fDel, e.CellBounds.Height);RectangleF rectMod new RectangleF(rectDel.Right, e.CellBounds.Top, e.CellBounds.Width * fMod, e.CellBounds.Height);RectangleF rectIsEnable new RectangleF(rectMod.Right, e.CellBounds.Top, e.CellBounds.Width* fIsEnable, e.CellBounds.Height);e.Graphics.DrawString(删除, myFont, Brushes.Black, rectDel, sf); //绘制“按钮”e.Graphics.DrawString(修改, myFont, Brushes.Black, rectMod, sf);e.Graphics.DrawString(启用/禁用, myFont, Brushes.Black, rectIsEnable, sf);e.Handled true;}} 以上代码是在DataGridView中可以显示需要的按钮。 给DataGridView添加事件可以通过按钮来操作数据库 使用CellMouseClick方法来去执行事件。 private void dgvwProdCode_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e){if (e.ColumnIndex 0 e.RowIndex 0){Point curPosition e.Location;//当前鼠标在当前单元格中的坐标if (this.dgvwProdCode.Columns[e.ColumnIndex].Name act){Graphics g this.dgvwProdCode.CreateGraphics();System.Drawing.Font myFont new System.Drawing.Font(宋体, 9F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(134)));SizeF sizeDel g.MeasureString(删除, myFont);SizeF sizeMod g.MeasureString(修改, myFont);SizeF sizeIsEnable g.MeasureString(启用/禁用, myFont);float fDel sizeDel.Width / (sizeDel.Width sizeMod.Width sizeIsEnable.Width);float fMod sizeMod.Width / (sizeDel.Width sizeMod.Width sizeIsEnable.Width);float fIsEnable sizeIsEnable.Width / (sizeDel.Width sizeMod.Width sizeIsEnable.Width);Rectangle rectTotal new Rectangle(0, 0, this.dgvwProdCode.Columns[e.ColumnIndex].Width, this.dgvwProdCode.Rows[e.RowIndex].Height);RectangleF rectDel new RectangleF(rectTotal.Left, rectTotal.Top, rectTotal.Width * fDel, rectTotal.Height);RectangleF rectMod new RectangleF(rectDel.Right, rectTotal.Top, rectTotal.Width * fMod, rectTotal.Height);RectangleF rectIsEnable new RectangleF(rectMod.Right, rectTotal.Top, rectTotal.Width * fIsEnable, rectTotal.Height);//判断当前鼠标在哪个“按钮”范围内if (rectDel.Contains(curPosition))//删除{IProduct product new ProductImpl();ProductInfoEntity productInfo new ProductInfoEntity();productInfo.recipe dgvwProdCode.Rows[e.RowIndex].Cells[1].Value.ToString();if (product.Delete(productInfo) 0){this.dgvwProdCode.Rows.RemoveAt(e.RowIndex);MessageBox.Show(删除成功);}dgvwProdCode.Refresh();//刷新显示}else if (rectMod.Contains(curPosition))//修改{// FormProductOperate formProductOperate new FormProductOperate();FormProductOperate formProductOperate FormProductOperate.GetInstance();formProductOperate.Text 修改产品;formProductOperate.btnAdd.Visible false;formProductOperate.btnConfirm.Visible true;formProductOperate.recipe dgvwProdCode.Rows[dgvwProdCode.CurrentRow.Index].Cells[1].Value.ToString();formProductOperate.Show();dgvwProdCode.Refresh();//刷新显示}else if (rectIsEnable.Contains(curPosition)){IProduct product new ProductImpl();//获取选中产品记录产品idstring recipe dgvwProdCode.Rows[dgvwProdCode.CurrentRow.Index].Cells[1].Value.ToString();if (product.UpdateStatus(recipe) 0){UpDataViewSource();MessageBox.Show(状态更改成功);}}}}} 在按钮上鼠标箭头变成小手样式 使用CellMouseMove方法 private void dgvwProdCode_CellMouseMove(object sender, DataGridViewCellMouseEventArgs e){if (e.ColumnIndex 0 e.RowIndex 0){Point curPosition e.Location;//当前鼠标在当前单元格中的坐标if (this.dgvwProdCode.Columns[e.ColumnIndex].Name act){this.Cursor Cursors.Hand;//解决绘图时画面闪烁SetStyle(ControlStyles.UserPaint, true);SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景.SetStyle(ControlStyles.DoubleBuffer, true); // 双缓冲}}} 这样在DataGridView中完整的按钮和操作就完成。以及样式上的修改。
http://www.hkea.cn/news/14427684/

相关文章:

  • 网站开发开票交税额网站 后台模板
  • wordpress建站的好处襄阳seo推广
  • php做的大型网站有哪些化工销售怎么做网站
  • 兼职 网站建设网站做系统叫什么名字
  • 丹东手机网站建站语言
  • 网站建设管理的规章制度上海做网站的企业
  • 深圳外包网站公司wordpress全站音乐
  • 免费建设网站领地品质好的深圳装修
  • 平台制作网站公司哪家好学校网站建设审批
  • 蓝田微网站建设wordpress模块管理系统
  • 深圳市建设局网站张局网站策划书总结
  • 个人建网站步骤京东网站建设设计框架图
  • 唐河永琚建筑公司网站网站建设的优缺点
  • 网站名字大全校园资源共享网站建设
  • 网站域名申请之后如何做网站企业管理培训课程目录
  • 成交型网站倡导公司网络营销策划书300字
  • 企业网站的价值体现是在南京哪家网络公司做网站优化好
  • 网站如何做微信支付宝支付宝支付接口建设公司logo图片大全
  • 怎么备份网站模板做网站跟网站设计的区别
  • 网站制作的目的品牌建设经验做法
  • 网站编辑 教程电子商务网站设计与实现
  • 企业的网站做一个要多少北京网站营销与推广
  • 网站还在建设就已经可以访问了_影响后期百度微信团购群网站怎样做
  • 58同城东莞招聘网站物理结构优化包含网页优化吗
  • 犀浦网站建设商城网站开发设计
  • 注册一个网站的流程广州企业网站制作
  • 网页设计制作与网站建设课程平台设计思路怎么写
  • 校园网站制作淘宝网站详情页怎么做
  • 外贸网站电子建设高州网站建设公司
  • 集团网站建设特色输入网址跳到别的网站