|
Imports System.Drawing
Imports System.Drawing.Graphics
Module PictureRelated
Sub joinPicture()
'每一张大图
Dim mm As Integer = 1
For Each ds As ptPaper In FinalPapers
'图片大小
newBMape = New Bitmap(CInt(841 * intDPI / 25.4), CInt(594 * intDPI / 25.4))
'设置分辨率
newBMape.SetResolution(intDPI, intDPI)
g1 = Graphics.FromImage(newBMape)
g1.Clear(Color.White)
For Each sdraw As SwDraw In ds.inNerPapers
myImage = Image.FromFile(sdraw.drawDir)
If sdraw.PaperSize = "A2" Then
myImage.RotateFlip(RotateFlipType.Rotate90FlipNone)
'如果是A2,则宽高翻转,同时将图像进行90度翻转
theHeight = CInt(sdraw.drawWidth * intDPI / 25.4)
theWidth = CInt(sdraw.drawHeight * intDPI / 25.4)
Else
theHeight = CInt(sdraw.drawHeight * intDPI / 25.4)
theWidth = CInt(sdraw.drawWidth * intDPI / 25.4)
End If
If sdraw.PaperSize = "A4" Then
theX = CInt(sdraw.insertPosX * intDPI * 210 / 25.4)
theY = CInt(sdraw.insertPosY * intDPI * 297 / 25.4)
End If
If sdraw.PaperSize = "A3" Then
theX = CInt(sdraw.insertPosX * intDPI * 210 / 25.4)
theY = CInt(sdraw.insertPosY * intDPI * 297 / 25.4)
End If
If sdraw.PaperSize = "A2" Then
theX = CInt(sdraw.insertPosX * intDPI * 210 / 25.4)
theY = CInt(sdraw.insertPosY * intDPI * 297 / 25.4)
End If
g1.DrawImage(myImage, theX, theY)
myImage.Dispose()
Next
If Form1.CBoxPaperSize.SelectedIndex = 1 Then
newBMape.RotateFlip(RotateFlipType.Rotate90FlipNone)
End If
If Form1.CBoxPrint.Checked = True Then
printThepaper()
End If
If Form1.CBoxPicSave.Checked = True Then
newBMape.Save(Application.StartupPath + "outputimagexx" + mm.ToString + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
End If
mm += 1
g1.Dispose()
newBMape.Dispose()
Next
End Sub
End Module
复制代码 |
|