&HCC0020 =蓝色
&H440328=很深的蓝
&H660046 =深紫色
&HEE0086 =比第1个深,比上1个浅的紫..
晕了.代码什么颜色..怎么好用语颤告如言友睁来回答你呵..
我可以帮助你,你先设置我最佳答案后,我百度Hii教茄启你。
一个非常简单的方法,非前中毕模拟按键慧芹。只用一个timer控件,和一个按扭就可以培悉。
Private
Declare
Function
GetDC
Lib
"user32"
(ByVal
hwnd
As
Long)
As
Long
Private
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
Private
Declare
Function
GetActiveWindow
Lib
"user32"
()
As
Long
Dim
a
Private
Sub
Command1_Click()
Timer1.Enabled
=
True
End
Sub
Private
Sub
Form_Load()
On
Error
Resume
Next
MkDir
"c:\zt"
'建文件夹
Me.AutoRedraw
=
True
End
Sub
Private
Sub
Timer1_Timer()
a
=
a
+
1
If
a
=
3
Then
'三秒后开始抓屏
Me.Hide
BitBlt
Me.hDC,
0,
0,
Screen.Width,
Screen.Height,
_
GetDC(GetActiveWindow),
0,
0,
vbSrcCopy
'抓屏
Me.Show
Dim
sFile
As
String
sFile
=
"C:\zt\"
&
Format(Now,
"yyyymmddhhmmss")
&
".BMP"
SavePicture
Me.Image,
sFile
'保存Me.hDC
Timer1.Enabled
=
False
End
If
End
Sub
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As LongPrivate Declare Function ReleaseDC _
Lib "user32" (ByVal hwnd As Long, _
ByVal hdc As Long) As Long
Private 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
Private Declare Function StretchBlt _
Lib "gdi32" (ByVal hdc 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 nSrcWidth As Long, _
ByVal nSrcHeight As Long, _
ByVal dwRop As Long) As Long
'首先,在窗体上添加个图片框PictureBox控件Name为Picture1
'截取指定位置指定大小的区域,保存到c:\1.bmp文件
Private Sub Form_Load()
Dim hDCtmp As Long
Dim w, h, X, Y
w = 300 ' 要截取屏幕部分的宽度银拍
h = 300 ' 要截取屏幕部锋链羡分的高度
X = 300 ' 横坐标 / 左唤御边界 Left
Y = 300 ' 纵坐标 / 上边界 Top
Me.Hide
hDCtmp = GetDC(0)
Picture1.BorderStyle = 0
Picture1.AutoRedraw = True
Picture1.Width = w * Screen.TwipsPerPixelX
Picture1.Height = h * Screen.TwipsPerPixelY
Call BitBlt(Picture1.hdc, 0, 0, w, h, hDCtmp, X, Y, vbSrcCopy)
ReleaseDC 0, hDCtmp
SavePicture Picture1.Image, "c:\1.bmp"
Me.Show
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)