手绘绘制矩形

扫码查看
谢谢!Andrew,Thanks, now the selection is freehand with your code. But this time ifi want to crop this selection and paste to as a new rectangle in apicturebox, i got the "parameter is not valid" error with this code:''a rectangle to set the location and size from the source imageDim rect As New Rectangle(cropX, cropY, cropWidth, cropHeight)Dim bit As Bitmap = New Bitmap(p.Image, p.Width, p.Height)''create a new bitmap with the width/height values that were specifiedin the textboxes.''bitmap to contain the cropped imageDim cropBitmap As BitmapcropBitmap = New Bitmap(cropWidth, cropHeight)''a new Graphics object that will draw on the cropBitmapDim g As Graphics = Graphics.FromImage(cropBitmap)''draw the portion of the image that you supplied cropping values for.g.DrawImage(bit, 0, 0, rect, GraphicsUnit.Pixel)'' "pbcrop" is blank picbox that a cropped image will be pasted into.pbCrop.Image = cropBitmapHow can i correct this?Thanks! 注意:代码因参数无效而失败关于此代码: cropBitmap =新位图(cropWidth,cropHeight) 更改为: cropBitmap =(Math.Abs​​(cropWidth),Math.Abs​​(cropHeight))消除了 错误,但没有看到裁剪的图像。 是有什么必须做的另外吗?Note: The code fails as "parameter is not valid" on this code:cropBitmap = New Bitmap(cropWidth, cropHeight)Changing it to:cropBitmap = (Math.Abs(cropWidth), Math.Abs(cropHeight)) eliminatederror but no cropped image is visible.Is there anything that must be done additionaly? 这篇关于手绘绘制矩形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-22 23:05
查看更多