IMAGEM DO FORMULARIO EM UM PICTURE BOX
dai pessoal...
estou necessitando colocar em um picturebox uma imagen de um form... mas teria que ser sem arquivo de imagem: ou seja, quero ter um snapshot do form sem usar imagem... é possÃvel?
peço desculpas se não fui claro o suficiente.
estou necessitando colocar em um picturebox uma imagen de um form... mas teria que ser sem arquivo de imagem: ou seja, quero ter um snapshot do form sem usar imagem... é possÃvel?
peço desculpas se não fui claro o suficiente.
Tipo navegador do photoshop?
naun sei dizer...
o que preciso é ter uma imagem do meu form1 em um picturebox no form2 - mas sem usar arquivo de imagem...
o que preciso é ter uma imagem do meu form1 em um picturebox no form2 - mas sem usar arquivo de imagem...
alguém?
Este código não é meu, mas já o testei e funciona.
Substitua o Form1 pelo nome do form que quer colocar no picture1
Private Declare Function SendMessage Lib "user32" Alias _
"SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const WM_PAINT = &HF
Private Const WM_PRINT = &H317
Private Const PRF_NONCLIENT = &H2&
Private Const PRF_CLIENT = &H4&
Private Const PRF_CHILDREN = &H10&
Private Const PRF_OWNED = &H20&
Private Sub cmdSnapShot_Click()
SnapShot Form1, Picture1
End Sub
Private Sub SnapShot(ByRef Source As Form, ByRef Dest As PictureBox)
Dim rv As Long
Dim sm As Integer
Dim ar As Boolean
Const BorderWidth = 60
On Error GoTo Exit_Sub
Me.ScaleMode = vbTwips
With Dest
.AutoRedraw = True
.ScaleMode = vbTwips
.Move .Left, .Top, Source.Width + BorderWidth, Source.Height + BorderWidth
End With
With Source
ar = .AutoRedraw
sm = .ScaleMode
.AutoRedraw = True
.ScaleMode = vbTwips
rv = SendMessage(.hwnd, WM_PAINT, .hDC, 0)
.Picture = .Image
Dest.PaintPicture .Picture, BorderWidth, .Height - .ScaleHeight - BorderWidth
rv = SendMessage(.hwnd, WM_PRINT, Dest.hDC, _
PRF_CHILDREN Or PRF_CLIENT Or PRF_OWNED Or PRF_NONCLIENT)
.AutoRedraw = ar
.ScaleMode = sm
End With
Exit_Sub:
If Err.Number Then MsgBox Err.Description, vbOKOnly
Dest.Picture = Dest.Image
Dest.Visible = True
End SubSubstitua o Form1 pelo nome do form que quer colocar no picture1
obrigado miguel... estarei verificando na próxima semana o código que vc postou
Este código funciona legal...
obrigado miguel... aparentemente funcionou
Tópico encerrado , respostas não são mais permitidas