Results 1 to 4 of 4

Thread: Why can't I export my picture1.image to a file?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Posts
    70

    Unhappy

    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"

  2. #2
    Guest
    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

  3. #3
    Guest
    I don't know what's the problem with the first code.
    I just tried it and it works great!

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jul 2000
    Posts
    70

    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
  •  



Click Here to Expand Forum to Full Width