Nomesoft® Forums
Welcome on Nomesoft® usersboard, Feel free to sign up and log in!
This is a forum about designing, programming and much more!
But also about every day's talk,
Have Fun
~ The Nomesoft® crew

Exclusive Tutorial - Controls to picture

View previous topic View next topic Go down

Exclusive Tutorial - Controls to picture

Post  Danny on Sun Dec 04, 2011 12:46 pm

This is an exclusive tutorial.
Follow the video and add the codes and you are done!
Video:

Codes:
Code:

Declare Auto Function SendMessage Lib "user32" ( _
          ByVal hWnd As IntPtr, _
          ByVal Msg As Integer, _
          ByVal wParam As IntPtr, _
          ByVal lParam As Integer) As Integer

    Private Enum EDrawingOptions As Integer
        PRF_CHECKVISIBLE = &H1
        PRF_NONCLIENT = &H2
        PRF_CLIENT = &H4
        PRF_ERASEBKGND = &H8
        PRF_CHILDREN = &H10
        PRF_OWNED = &H20
    End Enum

    Private Sub Button1_Click(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles Button1.Click

        Const WM_PRINT As Integer = &H317

        Dim myBmp As Bitmap
        Dim myGraphics As Graphics
        Dim hdc As System.IntPtr

        myBmp = New Bitmap( _
            Panel1.DisplayRectangle.Width, _
            Panel1.DisplayRectangle.Height)

        myGraphics = Graphics.FromImage(myBmp)

        hdc = myGraphics.GetHdc

        Call SendMessage(Panel1.Handle, WM_PRINT, hdc, _
            EDrawingOptions.PRF_CHILDREN Or _
            EDrawingOptions.PRF_CLIENT Or _
            EDrawingOptions.PRF_NONCLIENT Or _
            EDrawingOptions.PRF_OWNED)

        myGraphics.ReleaseHdc(hdc)

        PictureBox1.Image = myBmp

        myGraphics.Dispose()
        myGraphics = Nothing

        myBmp = Nothing

    End Sub

Hope you like this! please rate!

Danny

Posts: 19
Points: 45
Reputation: 0
Join date: 2011-02-19

View user profile

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum