2013-07-03 52 views
0

需要幫助請!使用「」抽繩,電子圖形「節省圖片」保存繪製字符串或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 

不保存圖片只是BLANK圖像顯示!

+0

你試試我的答案? – matzone

回答

-1

嘗試處置圖形保存之前..

g.Dispose() 
Bmp.Save("c:\Prompter\checking2.TIFF", Imaging.ImageFormat.Tiff) 
相關問題