-1

NEED HELP PLEASE ! Saving Picture with ""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

Not saving Picture just BLANK Image is showing !

matzone
  • 5,703
  • 3
  • 17
  • 20
Nazim Iqbal
  • 21
  • 1
  • 4

1 Answers1

-1

Try disposing graphics before save ..

g.Dispose()
Bmp.Save("c:\Prompter\checking2.TIFF", Imaging.ImageFormat.Tiff)
matzone
  • 5,703
  • 3
  • 17
  • 20