|
-
Jun 4th, 2011, 02:06 AM
#1
Thread Starter
Fanatic Member
Save drawing from PictureBox
Hey there,
I'm trying to save the lines I drew in a PictureBox as a bitmap, but it just returns blank images...
This is the code I have now:
vb Code:
'Draw a grid on PictureBox named draw
For x As Integer = 0 To bWidth
For y As Integer = 0 To bHeight
draw.CreateGraphics.DrawLine(Pens.Black, New Point(xStart + x * bScale, yStart), New Point(xStart + x * bScale, yStart + ySize))
draw.CreateGraphics.DrawLine(Pens.Black, New Point(xStart, yStart + y * bScale), New Point(xStart + xSize, yStart + y * bScale))
Next
Next
'Save as BMP-file
Dim bmp As New Bitmap(draw.Width, draw.Height)
draw.DrawToBitmap(bmp, New Rectangle(0, 0, draw.Width, draw.Height))
bmp.Save("D:\output.png", Imaging.ImageFormat.Png)
bmp.Dispose()
The file output.png in now a blank image, the size of the PictureBox. If I try to save the entire form with Me.DrawToBitmap(), I get the form itself but the PictureBox is blank, while the grid is visible on screen.
WHAT DO?!
Thanks for your help,
Alexander.
Last edited by arsmakman; Jun 4th, 2011 at 03:50 AM.
Reason: Issue resolved
No matter how fool-proof your program is, there will always be a better fool.
Was a post helpful to you? Rate it!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|