Lets say I have a picturebox. I created a line in the picturebox useing: line(0,0)-(400,300) or something like that. How would i then save what the picturebox is showing to a bitmap file?:confused:
Printable View
Lets say I have a picturebox. I created a line in the picturebox useing: line(0,0)-(400,300) or something like that. How would i then save what the picturebox is showing to a bitmap file?:confused:
i think it is
picture1.savepicture?
sorry
savepicture picture1, "c:\hello.jpg"
e.g.
VB Code:
Private Sub Command1_Click() SavePicture Picture1, "c:\hello.jpg" End Sub Private Sub Form_Load() Picture1.Picture = LoadPicture("c:\avatar.gif") End Sub
;)
Thanks, I know a lot of Visual Basic, but i don't know some of the really easy stuff for some reason.
np
Well you know what they say:
The more you know, the more u know u don't know :p
That worked but it only saved the picture that was loaded! I need it to save what is showing on the picturebox.
That is some of my code. When it does that it just covers the picture with points, which aren't saved.PHP Code:Private Sub mdiffuse_Click()
Form2.Caption = "VB Effect App-Working..."
For i = 1 To Picture1.ScaleHeight
For j = 1 To Picture1.ScaleWidth
pixval = Picture1.Point(j + Int(Rnd * 3), i + Int(Rnd * 3))
Picture1.PSet (j, i), pixval
Next j
Next i
Form2.Caption = "VB Effect App"
End Sub
picture1.picture = picture1.image
savepicture picture1, "c:\myfile.jpg"
;)
That still didn't work!! Is this even Possible?:confused: :confused: :confused: :confused: :confused: :confused:
yeah, that should work
i'm off to bed, tell me if it's not fixed (tomorrow) ;)
perhaps i'll just handball this q on, post it in the games and graphics forum, those guys will surely know how to do it ;)
Try this:
VB Code:
SavePicture Picture1.Image, "C:\mypic.bmp"
:rolleyes:
I already tried that. picture1.image is only the picture source and not all of what the picturebox is showing.
picture1.image is same as picture1.picture
It show nothing in the picture box .... ?Quote:
For i = 1 To Picture1.ScaleHeight
For j = 1 To Picture1.ScaleWidth
pixval = Picture1.Point(j + Int(Rnd * 3), i + Int(Rnd * 3))
Picture1.PSet (j, i), pixval
Next j
Next i
I've already got this problem fixed about saving. And for that code above, load a picture first
how did u do it in the end?
What is the answer because I want to know.
I've already asked him DaoK, so there is no point for you to ask as well :rolleyes:
Your noyt my father so keep your suggestion to yourself
you're posting crap so why don't u shutup
You post crap so shh
No i don't
I post more answers than you!
I dont post nearly as many answers as you! :D
For an actual answer to this q:
You can save Form.Image using the X,Y coords (Left, Top) of the picturebox you want, and the .Width, .Height of the PictureBox.
This should work - I have tried it successfully.
I am just curious why it's not working. That code will save whatever is drawn on the picture box(not only the image loaded in it).Quote:
Originally posted by Arrow_Raider
I already tried that. picture1.image is only the picture source and not all of what the picturebox is showing.
picture1.image is same as picture1.picture
I have tried it myself and it works fine.
This works for me:
VB Code:
Private Sub Command1_Click() Picture1.AutoRedraw = True Picture1.Line (0, 0)-(1000, 1000), vbBlack SavePicture Picture1.Image, "c:\tt.bmp" Picture2.Picture = LoadPicture("c:\tt.bmp") End Sub
-Lou