|
-
Dec 29th, 2005, 09:33 AM
#1
Thread Starter
New Member
[RESOLVED] picturebox - pset
Hi guys...
I have this problem thats really gonna make me mad... so I would be happy if you helped me...
Problem: When I use picture1.pset, draw the dots and save the image I only get a blank one... It probably doesn't recognize the dots in the picturebox as an image... But still I gotto use the dots. Can you guys help me out with this..
-
Dec 29th, 2005, 09:45 AM
#2
Re: picturebox - pset
Welcome to Forums, alicanSA!
It would be nice if you can show us how you do it.
-
Dec 29th, 2005, 09:55 AM
#3
Re: picturebox - pset
When you draw on a PictureBox you're drawing on a canvas that isn't persisted as the Picture property. You must either persist the image in the Picture property or save the canvas, which is available as the Image property of the control.
VB Code:
'This will save the canvas:
SavePicture Picture1.[b]Image[/b], "C:\ThePath\TheFileName.bmp"
'This will persist the canvas:
Set Picture1.Picture = Picture1.Image
'...and then save the picture
SavePicture Picture1.[b]Picture[/b], "C:\ThePath\TheFileName.bmp"
-
Dec 29th, 2005, 10:25 AM
#4
Thread Starter
New Member
Re: picturebox - pset
VB Code:
w = 0
h = 0
If Text3.Text = Empty Then
MsgBox ("Önce şifrele!")
Exit Sub
End If
Text3.Text = Text3.Text & "."
v = 1
k = 2
For w = 0 To Shape1.Width
For h = 0 To Shape1.Height
Picture1.PSet (w, h)
Next
Next
Do
z = InStr(k, Text3.Text, ".")
z1 = Mid(Text3.Text, k, z - k)
If v = 1 Then
x = Val(z1)
End If
If v = 2 Then
y = Val(z1)
End If
If v = 3 Then
c = Val(z1)
If c < 0 Then
Picture1.PSet (x, y), &HFFFFFF
Picture1.PSet (x + 1, y), &HFFFFFF
End If
If c > 0 Then
Picture1.PSet (x, y), &HFFFFFF
End If
v = 0
End If
v = v + 1
k = z + 1
Loop Until z = Len(Text3.Text)
[B]Set Picture1.Picture = Picture1.Image
SavePicture Picture1.Picture, "c:\sifre.bmp"[/B]
by the way Joacim your code did the same thing...
Edit: Added [vbcode][/vbcode] tags for more clarity. - Hack
-
Dec 29th, 2005, 10:31 AM
#5
Re: picturebox - pset
Is the AutoRedraw property of the Picture Box set to True? What ScaleMode are you using for the Form and for the PictureBox? Can you see the plotted image in the PictureBox?
-
Dec 29th, 2005, 10:44 AM
#6
Thread Starter
New Member
Re: picturebox - pset
AutoRedraw = false
scalemode = twip
plotted image = yes
.....
-
Dec 29th, 2005, 10:46 AM
#7
Re: picturebox - pset
AutoRedraw must be set to True.
-
Dec 29th, 2005, 12:27 PM
#8
Re: picturebox - pset
When it comes to graphics, always have your scalemode set to 3 - pixels to your forms and pictureboxes. It makes your life easier cause you can work with screen coordinates for a change rather than work in the 1000's range with twips. 
Also, be sure your Picturebox's autoredraw is True.
-
Dec 29th, 2005, 12:43 PM
#9
Thread Starter
New Member
Re: picturebox - pset
VB Code:
For w = 0 To Shape1.Width
For h = 0 To Shape1.Height
Picture1.PSet (w, h)
Next
Next
after removing this and making autoredraw true it worked!
and Jacob I know pixels make life easier... But this project is about crypto and ascii has like 216 words so I had to use twip(encrypts image by cordinates)
Anyways thanks!
-
Dec 29th, 2005, 08:16 PM
#10
Re: picturebox - pset
 Originally Posted by alicanSA
and Jacob I know pixels make life easier... But this project is about crypto and ascii has like 216 words so I had to use twip(encrypts image by cordinates)
Hmmm... The coordinates of an image is in pixels and not in twips.
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
|