save content of picture control


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 13 of 13

Thread: save content of picture control

  1. #1
    Join Date
    Mar 2008
    Posts
    164

    save content of picture control

    hi,
    i have placed some controls inside a picturebox and now i want save to a bmp,jpg file the content of the picturebox how can i do that?
    thanks a lot for your help

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Code:
    Private Sub Command1_Click()
      SavePicture Picture1.Image, "c:\test.bmp"
    End Sub
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Mar 2008
    Posts
    164
    hi, but this dont save the content of the picture if i put some controls inside of the picturei only see the picture file empty

  4. #4
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    It saves a picture of the content and that is what it is designed to do.

    Perhaps I don't understand what you mean by "content of the picture".

    What, exactly, are you trying to accomplish?
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  5. #5
    Join Date
    Mar 2008
    Posts
    164
    hi,
    my objective is save to a picture and print the content of a form or a picture.
    for example i have 10 command box created at runtime and other controls and i want print/export to picture(bmp.jpg) these controls like i see in the pc.

    i can print a form and all the controls inside but now i want save a picture with all form content inside, i have tested in form but without results so
    i switch the form to the picture but i canīt see the content when i save the image, but using a form or a picture my objective/problem is that save to a picture all the content(controls) that i see in the form.
    Note that when i say the content i donīt want the taskbar,caption and menus
    thanks a lot for your help

  6. #6
    Join Date
    Jan 2008
    Posts
    73
    Maybe I'm misunderstanding what you want to do, but it sounds like you want to save a Screen Shot of your Form. Why don't you do a Print Screen? Then you can paste it into Word or an image editor. Then you can save the clipboard capture in an image format. You can also automate this process in code.
    Last edited by CDRIVE; 05-21-2008 at 10:51 AM. Reason: punct

  7. #7
    Join Date
    Mar 2008
    Posts
    164
    the ideia is capture/export all content with just one click and without all that steps

  8. #8
    Join Date
    Jan 2008
    Posts
    73
    Quote Originally Posted by jason213123
    the ideia is capture/export all content with just one click and without all that steps
    You can probably use SendKeys to automate the process or this API.
    http://www.vbforums.com/showpost.php...95&postcount=4

  9. #9
    Join Date
    Jan 2008
    Posts
    73
    BTW, the reason you don't see the controls when you save the contents of a PicBox is because controls are not images. IE, they don't have an image file extension.

  10. #10
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    Quote Originally Posted by jason213123
    the ideia is capture/export all content with just one click and without all that steps
    Ok, then, try this
    Code:
    Private Declare Sub keybd_event Lib "user32" _
    (ByVal bVk As Byte, _
    ByVal bScan As Byte, _ 
    ByVal dwFlags As Long, _
    ByVal dwExtraInfo As Long) 
    
    Private Const VK_SNAPSHOT = &H2C 
    
    Private Function SaveScreen(ByVal theFile As String) As Boolean 
    'To get the Entire Screen 
    'Call keybd_event(vbKeySnapshot, 1, 0, 0) 
    
    'To get the Active Window 
    Call keybd_event(vbKeySnapshot, 0, 0, 0) 
    
    SavePicture Clipboard.GetData(vbCFBitmap), theFile 
    
    SaveScreen = True 
    End Function 
    
    Private Sub Command1_Click()
    Call SaveScreen("C:\Windows\Desktop\shot1.bmp") 
    End Sub
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  11. #11
    Join Date
    May 2008
    Location
    Chicago, IL
    Posts
    64
    David CodeGuru Article: Bound Controls are Evil-VB6

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  12. #12
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    He is using VB6, not .NET
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  13. #13
    Join Date
    Mar 2008
    Posts
    164
    hi,
    thanks a lot for your help

Similar Threads

  1. Path for save picture as
    By brhusk in forum VB Classic
    Replies: 4
    Last Post: 12-27-2007, 10:33 AM
  2. How To save image in MDB from image control.
    By LiveSys in forum VB Classic
    Replies: 1
    Last Post: 04-15-2007, 07:30 PM
  3. Save the content browser in a file.
    By Leo in forum ASP.NET
    Replies: 0
    Last Post: 08-13-2002, 11:37 PM
  4. RichTextBox Control and CMS.....
    By Bio in forum ASP.NET
    Replies: 0
    Last Post: 05-15-2002, 10:38 AM
  5. How resize and save a picture
    By antonio in forum VB Classic
    Replies: 10
    Last Post: 12-04-2000, 10:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center