|
-
Sep 28th, 2000, 03:28 PM
#1
Thread Starter
Lively Member
code:
Option Explicit
Private Sub Form_Click()
' Declare variables.
Dim CX, CY, Limit, Radius As Integer, Msg As String
ScaleMode = vbPixels ' Set scale to pixels.
AutoRedraw = True ' Turn on AutoRedraw.
Width = Height ' Change width to match height.
CX = ScaleWidth / 2 ' Set X position.
CY = ScaleHeight / 2 ' Set Y position.
Limit = CX ' Limit size of circles.
For Radius = 0 To Limit ' Set radius.
Picture1.Circle (CX, CY), Radius, _
RGB(Rnd * 255, Rnd * 255, Rnd * 255)
DoEvents ' Yield for other processing.
Next Radius
Msg = "Choose OK to save the graphics from this form "
Msg = Msg & "to a bitmap file."
MsgBox Msg
SavePicture Picture1.Image, _
"TEST.BMP" ' Save picture to file.
End Sub
This works for good if the circles are assigned to the picture prop of the form, however when assigned to the image of the picture test.bmp returns empty. Why and how does that happen?
Kiziltan Yuceil
Freelance Web/VB/VBA Programmer
"It's not what you know it's to whom you consult and with whom you collaborate"
-
Sep 28th, 2000, 03:36 PM
#2
Try this:
Code:
Option Explicit
Private Sub Form_Click()
' Declare variables.
Dim CX, CY, Limit, Radius As Integer, Msg As String
ScaleMode = vbPixels ' Set scale to pixels.
AutoRedraw = True ' Turn on AutoRedraw.
Width = Height ' Change width to match height.
CX = ScaleWidth / 2 ' Set X position.
CY = ScaleHeight / 2 ' Set Y position.
Limit = CX ' Limit size of circles.
For Radius = 0 To Limit ' Set radius.
Picture1.Circle (CX, CY), Radius, _
RGB(Rnd * 255, Rnd * 255, Rnd * 255)
DoEvents ' Yield for other processing.
Next Radius
Msg = "Choose OK to save the graphics from this form "
Msg = Msg & "to a bitmap file."
MsgBox Msg
[b]SavePicture Picture1.Picture, _
"TEST.BMP" ' Save picture to file.[b]
End Sub
-
Sep 28th, 2000, 03:43 PM
#3
I don't know what's the problem with the first code.
I just tried it and it works great!
-
Sep 28th, 2000, 03:46 PM
#4
Thread Starter
Lively Member
Sorry, errored!
I tried it beforehand. But I gave it a chance 2nd time, it's all the same : "Invalid property error! (380)" 
Any other suggestions?
Kiziltan Yuceil
Freelance Web/VB/VBA Programmer
"It's not what you know it's to whom you consult and with whom you collaborate"
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
|