本文介绍了vb如何擦除一块图像并用trasparency替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我想擦拭一张图片并换上透明图片 我这样做了: Dim aw As UInteger = com.tilesizewidth Dim ah As UInteger = com.tilesizeheight 如果 multisel 那么 aw = Abs(pnt2.X - pnt.X) ah = Abs(pnt2.X - pnt.X) multisel = False drawselrect = False selectedfirstpnt = True 结束 如果 ' Dim cloneimg = sourceimg.Clone() 使用 g As Graphics = Graphics.FromImage(sourceimg) ' g.DrawRectangle(New Pen(New TextureBrush(cloneimg)),pnt .X,pnt.Y,aw,啊) g.FillRegion(Brushes.Trasparent,新区域(新矩形(pnt.X,pnt.Y,aw,啊))) ' g.FillRegion(Brushes.White,New Region(新矩形(pnt.X,pnt.Y,aw,啊))) 结束 使用 imgsaved = 错误 pic .Invalidate() g.FillRegion(Brushes.Trasparent,New Region(New Rectangle(pnt.X,pnt.Y,aw)啊)))不工作 g.FillRegion(Brushes.White,New Region(新矩形(pnt.X,pnt.Y,aw,啊)))有效,但它是白色的!解决方案 I want to wipe a piece of image and replace it with trasparencyI did this:Dim aw As UInteger = com.tilesizewidth Dim ah As UInteger = com.tilesizeheight If multisel Then aw = Abs(pnt2.X - pnt.X) ah = Abs(pnt2.X - pnt.X) multisel = False drawselrect = False selectedfirstpnt = True End If 'Dim cloneimg = sourceimg.Clone() Using g As Graphics = Graphics.FromImage(sourceimg) 'g.DrawRectangle(New Pen(New TextureBrush(cloneimg)), pnt.X, pnt.Y, aw, ah) g.FillRegion(Brushes.Trasparent, New Region(New Rectangle(pnt.X, pnt.Y, aw, ah))) 'g.FillRegion(Brushes.White, New Region(New Rectangle(pnt.X, pnt.Y, aw, ah))) End Using imgsaved = False pic.Invalidate()g.FillRegion(Brushes.Trasparent, New Region(New Rectangle(pnt.X, pnt.Y, aw, ah))) don't workg.FillRegion(Brushes.White, New Region(New Rectangle(pnt.X, pnt.Y, aw, ah))) works but it's white!! 解决方案 这篇关于vb如何擦除一块图像并用trasparency替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-11 08:19