www.pc3enter.tk
یک شنبه 30 بهمن 1390, 09:19 صبح
سلام
من یک سوال داشتم ان هم اینکه
چطوری می توان از فرم خود برنامه عکس گرفت
یعنی اینکه تمام محتویات دکمه تکس باکس یا هرچیزی دیگری که داخل فرم است بتوانم از ان عکس بگیرم و در جایی ذخیره کنم
ayub_coder
یک شنبه 30 بهمن 1390, 10:09 صبح
به یاد قدیما :لبخندساده:
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 KEYEVENTF_KEYUP = &H2
Function GetScreenBitmap(Optional ActiveWindow As Boolean) As Picture
Dim pic As StdPicture
Set pic = Clipboard.GetData(vbCFBitmap)
' Alt-Print Screen captures the active window only
If ActiveWindow Then
' Press the Alt key
keybd_event vbKeyMenu, 0, 0, 0
End If
' Press the Print Screen key
keybd_event vbKeySnapshot, 0, 0, 0
DoEvents
' Release the Print Screen key
keybd_event vbKeySnapshot, 0, KEYEVENTF_KEYUP, 0
If ActiveWindow Then
' Release the Alt key
keybd_event vbKeyMenu, 0, KEYEVENTF_KEYUP, 0
End If
DoEvents
' return the bitmap now in the clipboard
Set GetScreenBitmap = Clipboard.GetData(vbCFBitmap)
' restore the original contents of the clipboard
Clipboard.SetData pic, vbCFBitmap
End Function
Private Sub Command1_Click()
SavePicture GetScreenBitmap(True), "c:\a.bmp"
End Sub
اگه به جای اون True مقدار False وارد کنید از کل صفحه عکس میگیره.
موفق باشید
vBulletin® v4.2.5, Copyright ©2000-1404, Jelsoft Enterprises Ltd.