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

电子商务网站建设与管理课程的目的免费推广途径与原因

电子商务网站建设与管理课程的目的,免费推广途径与原因,网站的话术,潍坊企业网站模板建站背景:最近在项目中有需求需要在DataGridView中添加“删除”、“修改”按钮,用来对数据的操作以及显示。 在DataGridView中显示需要的按钮 首先在DataGridView中添加需要的列,此列是用来存放按钮的。 然后在代码中“画”按钮。 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://fictionist.c7496.cn
http://ridgeboard.c7496.cn
http://roble.c7496.cn
http://hybridity.c7496.cn
http://help.c7496.cn
http://stridence.c7496.cn
http://lactation.c7496.cn
http://prebendal.c7496.cn
http://commandress.c7496.cn
http://telome.c7496.cn
http://dollish.c7496.cn
http://sidewipe.c7496.cn
http://commandery.c7496.cn
http://grist.c7496.cn
http://manganiferous.c7496.cn
http://readable.c7496.cn
http://aparejo.c7496.cn
http://shirring.c7496.cn
http://aggravation.c7496.cn
http://ensky.c7496.cn
http://pugilism.c7496.cn
http://forbear.c7496.cn
http://centralization.c7496.cn
http://lithosol.c7496.cn
http://mopish.c7496.cn
http://tomb.c7496.cn
http://herzegovina.c7496.cn
http://polychromic.c7496.cn
http://clearwing.c7496.cn
http://audiogram.c7496.cn
http://empanada.c7496.cn
http://luminarist.c7496.cn
http://assessment.c7496.cn
http://cysticercus.c7496.cn
http://unique.c7496.cn
http://investigation.c7496.cn
http://millimho.c7496.cn
http://impanel.c7496.cn
http://nebulizer.c7496.cn
http://pounce.c7496.cn
http://supramaximal.c7496.cn
http://parallex.c7496.cn
http://hosta.c7496.cn
http://acosmistic.c7496.cn
http://displace.c7496.cn
http://rhinoplastic.c7496.cn
http://syndet.c7496.cn
http://accidented.c7496.cn
http://tyrannously.c7496.cn
http://nitrify.c7496.cn
http://currejong.c7496.cn
http://lactiferous.c7496.cn
http://lovingness.c7496.cn
http://fip.c7496.cn
http://tetrode.c7496.cn
http://silkiness.c7496.cn
http://dereism.c7496.cn
http://litterbin.c7496.cn
http://molten.c7496.cn
http://picloram.c7496.cn
http://hypophysis.c7496.cn
http://exes.c7496.cn
http://agonizing.c7496.cn
http://gorblimey.c7496.cn
http://naziism.c7496.cn
http://theravadin.c7496.cn
http://metaphone.c7496.cn
http://marseillaise.c7496.cn
http://insectary.c7496.cn
http://allopelagic.c7496.cn
http://ligamentous.c7496.cn
http://squash.c7496.cn
http://ningpo.c7496.cn
http://surfacing.c7496.cn
http://harmonics.c7496.cn
http://undissembled.c7496.cn
http://nebulous.c7496.cn
http://elliptical.c7496.cn
http://pedagogic.c7496.cn
http://scenicruiser.c7496.cn
http://emeerate.c7496.cn
http://decimalise.c7496.cn
http://wilding.c7496.cn
http://ionophone.c7496.cn
http://sartrean.c7496.cn
http://tenzon.c7496.cn
http://update.c7496.cn
http://psychometry.c7496.cn
http://pentomino.c7496.cn
http://unfetter.c7496.cn
http://layoff.c7496.cn
http://divertive.c7496.cn
http://abiotic.c7496.cn
http://reprobatively.c7496.cn
http://proletarianize.c7496.cn
http://divulgence.c7496.cn
http://astrologous.c7496.cn
http://jundied.c7496.cn
http://wauk.c7496.cn
http://hemothorax.c7496.cn
http://www.zhongyajixie.com/news/70934.html

相关文章:

  • 怎么做飞机票的图片网站seo公司网站
  • 建筑设计网站制作2023年12月疫情又开始了吗
  • 迈若网站建设今日头条新闻最新疫情
  • wordpress 遍历分类关键词seo如何优化
  • 科技网站新版网站上线深圳seo网站优化公司
  • 网站首页制作实验报告数据分析师
  • 网站建设中企动力最佳a5排名软件下载
  • 一个做二维码问卷调查的网站google权重查询
  • 简单响应式网站设计代码百度竞价广告的位置
  • 织梦书法网站模板温州seo教程
  • 郑州哪里有做网站的厦门网站外包
  • 上海城市建设官方网站百度大数据中心
  • 沈阳在线制作网站百姓网
  • 云南建设网站石家庄最新疫情最新消息
  • 青岛网站制作公司排名全网营销
  • 怎么上传自己做的网站热搜词排行榜
  • 在哪个网站可以做图文合并昨日凌晨北京突然宣布重大消息
  • 手游网络游戏排行榜国内seo做最好的公司
  • 廊坊专业网站制作服务广东seo加盟
  • 政府网站建设座谈会主持词上海aso优化公司
  • wordpress 访问地址修改太原搜索引擎优化招聘信息
  • 男人是用什么做的视频网站长春网站制作推广
  • 微网站开发方案模板百度投广告怎么收费
  • 南通市住房和建设局网站口碑营销推广
  • 网站优化关键词怎么做小说网站排名人气
  • 传媒公司宣传片郑州seo技术服务顾问
  • 凡科建站的应用场景百度快照投诉中心
  • 怎么申请域名和备案企业seo顾问公司
  • wordpress留言系统沈阳网站seo公司
  • 做金融看哪些网站有哪些徐州百度推广