VB如何编写可以截屏与在截来的屏图片中做同心圆图

来源:百度知道 编辑:UC知道 时间:2024/06/24 06:40:21
要求:截屏,把截屏的图片放到一个图片框中,然后可以在图片框中可以作图,可以作角平分线,可以作等距离的同心圆,要求光标成十字形

后面你说的看似很简单
那么就交给你解决了
我给你截屏的函数,是用API函数写的
给不给分你看着办吧
需要一个Picturebox控件
Private Declare Function GetDC Lib "user32" (ByVal hwnd 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

Private Sub Command1_Click()
Dim wScreen As Long
Dim hScreen As Long
Dim w As Long
Dim h As Long
Picture1.Cls

wScreen = Screen.Width \ Screen.TwipsPerPixelX
hScreen = Screen.Height \ Screen.TwipsPerPixelY

Picture1.ScaleMode = vbPixels
w = Picture1.ScaleWidth
h = Picture1.ScaleHeight

hdcScreen = GetDC(0)

r = StretchBlt(Picture1.hdc, 0, 0, w, h, hdcScreen, 0, 0, wScreen, hScreen, vbSrcCopy)

End Sub