|
楼主 |
发表于 2017-3-27 23:01
|
显示全部楼层
代码:
- Private Type POINTAPI
- x As Long
- y As Long
- End Type
- Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
- Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
- Private Declare Function CreateDIBPatternBrushPt Lib "gdi32" (lpPackedDIB As Any, ByVal iUsage As Long) As Long
- Private Declare Function PlgBlt Lib "gdi32" (ByVal hdcDest As Long, lpPoint As POINTAPI, ByVal hdcSrc As Long, ByVal nXSrc As Long, ByVal nYSrc As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hbmMask As Long, ByVal xMask As Long, ByVal yMask As Long) As Long
- Private Declare Function PatBlt Lib "gdi32" (ByVal HDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal dwRop As Long) As Long
- Private Declare Function SelectObject Lib "gdi32" (ByVal HDC As Long, ByVal hObject As Long) As Long
- Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
- Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal HDC As Long) As Long
- Private Const PI As Double = 3.1415926
- Private Sub CommandButton1_Click()
- Dim pt(0 To 3) As POINTAPI
- dThetaDeg = 3 '扭曲度数
- Sida = dThetaDeg * PI / 180
- dx = UserForm1.Width '300
- dy = UserForm1.Height '300
- pt(0).x = dx * Sin(Sida)
- pt(0).y = dy - dy * Cos(Sida)
- pt(1).x = pt(1).x + dx * Cos(Sida)
- pt(1).y = pt(1).y + dx * Sin(Sida)
- pt(2).x = 0
- pt(2).y = dy
- pt(3).x = pt(2).x + dx * Cos(Sida)
- pt(3).y = pt(2).y + dx * Sin(Sida)
- hwnd& = FindWindow(vbNullString, "UserForm2")
- HDC = GetDC(hwnd)
- PlgBlt HDC, pt(0), GetDC(0), 0, 0, 100, 100, ByVal 0&, ByVal 0&, ByVal 0&
- End Sub
复制代码
请大侠帮忙修改 |
|