我有 2 个图片框,我只想将它们导出为 1 张图片。我只需要以它们的状态导出它们,而不是创建 .bmp。我尝试将其作为表单的屏幕截图,但问题是有时图片比表单大,屏幕截图仅截取表单可见的部分,我该怎么办?
这是屏幕截图的代码示例
MenuStrip1.Hide()
Dim bmpScreenshot As Bitmap = New Bitmap(Width, Height, PixelFormat.Format32bppArgb)
' Create a graphics object from the bitmap
Dim gfxScreenshot As Graphics = Graphics.FromImage(bmpScreenshot)
' Take a screenshot of the entire Form1
gfxScreenshot.CopyFromScreen(Me.Location.X, Me.Location.Y, 0, 0, Me.Size, CopyPixelOperation.SourceCopy)
' Save the screenshot
SaveFileDialog1.ShowDialog()
SaveFileDialog1.Filter = "Image files (*.PNG)|*.PNG|(*.JPG*)|*.JPG*"
bmpScreenshot.Save(SaveFileDialog1.FileName)
MenuStrip1.Show()