将面板保存为 JPEG,仅保存可见区域 c#
我正在尝试保存,然后在 C# 中打印面板。我唯一的问题是它只保存可见区域,当我向下滚动时它会打印出来。
Bitmap bmp = new Bitmap(this.panel.Width, this.panel.Height);
this.panel.DrawToBitmap(bmp, new Rectangle(0, 0, this.panel.Width, this.panel.Height));
bmp.Save("c:\\panel.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
I'm trying to save, and then print a panel in c#. My only problem is that it only saves the visible areas and when I scroll down it prints that.
Bitmap bmp = new Bitmap(this.panel.Width, this.panel.Height);
this.panel.DrawToBitmap(bmp, new Rectangle(0, 0, this.panel.Width, this.panel.Height));
bmp.Save("c:\\panel.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试以下操作
这是我的结果:
Form ScreenShot :
保存的位图 :
正如您所看到的,有一个 TextBox 在表单上不可见,但存在于保存的位图
Try following
Here is my result:
Form ScreenShot :
Saved bitmap :
As you can see there is TextBox wich is not visible on form but is present in saved bitmap
注意:工作正常
Note: Its working fine