-1

需要帮助!用 ""Drawstring, e.graphic"" 保存图片

Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)

    Dim Bmp As New Bitmap(Width, Height)
    Dim objBitmap As New Bitmap(Width, Height)

    objBitmap.Save("c:\Prompter\checking2.TIFF")

    Dim g As Graphics = Graphics.FromImage(Bmp)
    Dim cx As Integer = Width
    Dim cy As Integer = Height
    Dim pen As New Pen(Color.Black)
    Dim rect As New Rectangle(0, 0, Width, Height)

    Dim drawFormat As New StringFormat()
    drawFormat.Alignment = StringAlignment.Center
    drawFormat.LineAlignment = StringAlignment.Center

    Dim stringFont As New Font("Arial", 50)
    g.DrawString(RichTextBox1.Text, stringFont, New SolidBrush(Color.White), rect, drawFormat)

    Bmp.Save("c:\Prompter\checking2.TIFF", Imaging.ImageFormat.Tiff)

    Using bmp2 As New Drawing.Bitmap(Width, Height)
        DrawToBitmap(Bmp, New Rectangle(0, 0, Bmp.Width, Bmp.Height))
        Bmp.Save("c:\Prompter\screenshoot.bmp")
    End Using 
End Sub

不保存图片只是显示空白图像!

4

1 回答 1

-1

在保存之前尝试处理图形..

g.Dispose()
Bmp.Save("c:\Prompter\checking2.TIFF", Imaging.ImageFormat.Tiff)
于 2013-07-04T00:12:31.410 回答