Results 1 to 15 of 15

Thread: Screnshots of specific are on a form?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2009
    Posts
    358

    Screnshots of specific are on a form?

    I'm making a program that I need to make a screenshot of a specified area on the form. What I am making is a utility to make my 2d rpg game. All I need to know is how to code it so it will take the picture of the specified area then copy the picture to the clipboard.
    Thanks for any help in advanced.

  2. #2
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: Screnshots of specific are on a form?

    You can try copying the portion to a borderless form, then copying the form. I do this with a richtextbox and mshflexgrid. Using printwidow you do not have to show the form

    http://www.vbforums.com/showthread.p...ht=printwindow
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2009
    Posts
    358

    Re: Screnshots of specific are on a form?

    All right, that helps a lot, now all I need to know how to do is automatically do the Alt+Prt Sc.
    Know how to add that into the code? Like would some kind of Sendkeys work?

  4. #4
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: Screnshots of specific are on a form?

    Quote Originally Posted by CoBHC View Post
    All right, that helps a lot, now all I need to know how to do is automatically do the Alt+Prt Sc.
    Know how to add that into the code? Like would some kind of Sendkeys work?
    Call you sub with a button click
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2009
    Posts
    358

    Re: Screnshots of specific are on a form?

    Quote Originally Posted by isnoend07 View Post
    Call you sub with a button click
    How do you do that?

  6. #6
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: Screnshots of specific are on a form?

    Quote Originally Posted by CoBHC View Post
    How do you do that?
    Private Sub Command1_Click()
    Call YourSub
    End Sub
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  7. #7
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,255

    Re: Screnshots of specific are on a form?

    Quote Originally Posted by CoBHC View Post
    All right, that helps a lot, now all I need to know how to do is automatically do the Alt+Prt Sc.
    Know how to add that into the code? Like would some kind of Sendkeys work?
    If you have your captured image in a picturebox you can use the Clipboard.SetData command.

    Code:
       ' copy image in picture1 to clipboard as bitmap
       Clipboard.Clear
       Clipboard.SetData Picture1.Image, vbCFBitmap
    Most capturing that uses a picture box requires it to be set to AutoRedraw =True , then after the capture you .Refresh the pic box, then call the clipboard.setdata command.

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2009
    Posts
    358

    Re: Screnshots of specific are on a form?

    I want it to automatically save the images if I click yes or no. I need to know exactly how to set the sub to capture the image.
    Do I use a module and call PrintScreen()?

  9. #9
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: Screnshots of specific are on a form?

    Quote Originally Posted by CoBHC View Post
    I want it to automatically save the images if I click yes or no. I need to know exactly how to set the sub to capture the image.
    Do I use a module and call PrintScreen()?
    Private Sub Command1_Click()
    'as Edgemeal stated
    Clipboard.Clear
    Clipboard.SetData Picture1.Image, vbCFBitmap
    End Sub
    Change to you picturebox name
    The picture will be on the clipboard
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2009
    Posts
    358

    Re: Screnshots of specific are on a form?

    Quote Originally Posted by isnoend07 View Post
    Private Sub Command1_Click()
    'as Edgemeal stated
    Clipboard.Clear
    Clipboard.SetData Picture1.Image, vbCFBitmap
    End Sub
    Change to you picturebox name
    The picture will be on the clipboard
    Yeah, but I don't get it, will that actually take the screenshot???
    You see, what I am aiming to do is actually press a button and save an image of a certain area on a form and then choose to save it to a folder I already made, I can handle the saving part, I just need to know the control to capture the screen with a button.
    Last edited by CoBHC; Apr 25th, 2009 at 12:42 AM. Reason: I needed to add detail.

  11. #11
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: Screnshots of specific are on a form?

    Quote Originally Posted by CoBHC View Post
    Yeah, but I don't get it, will that actually take the screenshot???
    You see, what I am aiming to do is actually press a button and save an image of a certain area on a form and then choose to save it to a folder I already made, I can handle the saving part, I just need to know the control to capture the screen with a button.
    It just gets easier:
    Set autodraw to true
    SavePicture Picture1, ("c:\mypic.bmp")
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  12. #12

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2009
    Posts
    358

    Re: Screnshots of specific are on a form?

    So if I place my picturebox over an area, it will capture a screenshot of that are on the form with that control?

  13. #13
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    Re: Screnshots of specific are on a form?

    Quote Originally Posted by CoBHC View Post
    So if I place my picturebox over an area, it will capture a screenshot of that are on the form with that control?
    This will save what is in your picturebox to a file. Is this not what you want ?

    Private Sub Command1_Click()
    SavePicture Picture1, ("c:\mypic.bmp")
    End Sub
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  14. #14

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2009
    Posts
    358

    Re: Screnshots of specific are on a form?

    Quote Originally Posted by isnoend07 View Post
    This will save what is in your picturebox to a file. Is this not what you want ?

    Private Sub Command1_Click()
    SavePicture Picture1, ("c:\mypic.bmp")
    End Sub
    What I want is basically Alt + PrtSc in a command button. then choose to save the screenshot to a file.

  15. #15

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2009
    Posts
    358

    Re: Screnshots of specific are on a form?

    Yeah, that's what I want, but I can't figure out what exact code in there captures it.

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