I am completely confused onto using GDI/graphics; and I hope someone can help me out with this one. I have a form with 1 picturebox (picturebox1) and 1 button (button1)...
I am trying to create a simple program that drawstrings the current time, and keeps redrawing it; while having a button that lets you save it to a .png file.
this is the jumble of code i have made currently; but i do not know how to put it together and make it work; help, please and thankyou!
I am trying to create a simple program that drawstrings the current time, and keeps redrawing it; while having a button that lets you save it to a .png file.
this is the jumble of code i have made currently; but i do not know how to put it together and make it work; help, please and thankyou!
VB.NET:
Dim graphics As Graphics = PictureBox1.CreateGraphics
Dim font As New Font("Arial", 15, FontStyle.Bold)
'draw time
graphics.DrawString(Now, font, Brushes.Red, 0, 0)
'draw graphics to bitmap
Dim img As New Bitmap(720, 100, graphics)
'save to file
img.Save("C:\img.png", System.Drawing.Imaging.ImageFormat.Png)
'dispose objects
PictureBox1.CreateGraphics.Dispose()
img.Dispose()
graphics.Dispose()
font.Dispose()