投稿時間:2003/10/29(Wed) 11:16 投稿者名:とおりすがり
Eメール:
URL :
タイトル:Re: 選択範囲をクリップボードにキャプチャ
こんなんどうでしょう? とりあえず適当なので、そこらへんは自己責任ってことで 用意するもの Form1 commandButton Picture1 Form2 標準モジュール
'標準モジュール@@@@@@@@@@@@@@@@@@@@@@@
Option Explicit
Public Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Public Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long Public DeskTopDC As Long Public StartX As Single Public StartY As Single Public EndX As Single Public EndY As Single
'Form1@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Option Explicit Private Sub Command1_Click() Unload Me Load Form2 End Sub
Private Sub Form_Load() With Picture1 .Appearance = 0 .AutoRedraw = True .BorderStyle = vbBSNone .ScaleMode = vbPixels End With Me.Show End Sub
'Form2@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Option Explicit Private Sub Form_Load() With Me .AutoRedraw = True .Caption = "" .Width = Screen.Width .Height = Screen.Height .ScaleMode = vbPixels End With DeskTopDC = GetDC(0) Me.Show BitBlt Me.hDC, 0, 0, Screen.Width, Screen.Height, DeskTopDC, 0, 0, vbSrcCopy Me.Refresh End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) StartX = X StartY = Y End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) EndX = X EndY = Y Load Form1 BitBlt Form1.Picture1.hDC, 0, 0, EndX - StartX, EndY - StartY, DeskTopDC, StartX, StartY, vbSrcCopy Form1.Picture1.Refresh Unload Me End Sub
|