以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  painter  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=145391)

--  作者:刘林
--  发布时间:2020/1/18 12:01:00
--  painter
Dim p As WinForm.Painter = e.Form.Controls("Painter1")
Dim img As Image = getimage("D:\\test.jpg")
Dim bmpOut As new Bitmap(290, 185, PixelFormat.Format24bppRgb) \'290为裁剪区域宽度,185为高度
Dim myGraphics As Graphics = Graphics.FromImage(bmpOut)
myGraphics.Clear(Color.White)
myGraphics.DrawImage(img, new Rectangle(0, 0, 290, 185), new Rectangle(270, 100, 290, 185), GraphicsUnit.Pixel) \'270为原图需要裁剪的区域的左边距,100为上边距
myGraphics.Dispose()
bmpOut.Save("E:\\问题\\123_1.png")


老师,你好,我想不用存而是将剪切的图片在P中显示出来这怎么改,没理清关系

--  作者:有点蓝
--  发布时间:2020/1/18 14:17:00
--  
Dim img As Image = getimage("D:\\test.jpg")
Dim bmpOut As new Bitmap(290, 185, PixelFormat.Format24bppRgb) \'290为裁剪区域宽度,185为高度
Dim myGraphics As Graphics = Graphics.FromImage(bmpOut)
myGraphics.Clear(Color.White)
myGraphics.DrawImage(img, new Rectangle(0, 0, 290, 185), new Rectangle(270, 100, 290, 185), GraphicsUnit.Pixel) \'270为原图需要裁剪的区域的左边距,100为上边距
Dim p As WinForm.Painter = e.Form.Controls("Painter1")
Dim
 g As Graphics = p.Graphics
g.DrawImage(
bmpOut,10,10)