我试图在PictureBox1中裁剪并调整图片大小。我的代码:
//original image for eventually undo
undoImage = pictureBox1.BackgroundImage.Clone() as Image;
Bitmap sourceBitmap = new Bitmap(pictureBox1.BackgroundImage, pictureBox1.Width, pictureBox1.Height);
Graphics g = pictureBox2.CreateGraphics();
g.DrawImage(sourceBitmap, new Rectangle(0, 0, pictureBox2.Width, pictureBox2.Height), rectCropArea, GraphicsUnit.Pixel);
sourceBitmap.Dispose();
它在两个PictureBox
es上正常工作。
但是PictureBox2.Image
,PictureBox2.BackgroundImage
(以及任何其他包括ErrorImage ...)= null
。
我尝试了PictureBox.DrawToBitmap
和其他广告,例如谷歌上发现的g.GetHdc()
,但未成功。
我的问题:
如何将编辑过的图像从PictureBox2
正确复制到PictureBox1
?
答案 0 :(得分:-2)
琐碎的解决方案:
cross_entropy = tf.losses.log_loss(labels, predictions)