|
- Sub 按钮1_Click()
- Dim hDC As Long, junk, Px, Py, PPI
- hDC = GetDC(0)
- PPI = GetPPI
- Px = ActiveWindow.PointsToScreenPixelsX(0)
- Py = ActiveWindow.PointsToScreenPixelsY(0)
- For Each shp In ActiveSheet.Shapes
- If shp.Type = msoLine Then
- With shp
- l = .Left / 72 * PPI
- t = .Top / 72 * PPI
- h = .Height / 72 * PPI
- w = .Width / 72 * PPI
-
- temp = GetPixel(hDC, Px + l + w / 2, Py + t + h / 2)
-
- temp1 = GetPixel(hDC, Px + l + w / 4, Py + t + h / 4)
- temp2 = GetPixel(hDC, Px + l + w / 4, Py + t + h * 3 / 4)
-
- 'junk = SetCursorPos(Px + l + w / 4, Py + t + h * 3 / 4)
- End With
- Exit For
- End If
- Next
- junk = ReleaseDC(0, hDC)
- If temp1 = temp Then
- If temp2 = temp Then MsgBox "水平或垂直" Else MsgBox "左上右下"
- ElseIf temp2 = temp Then
- MsgBox "左下右上"
- Else
- MsgBox "识别方向失败"
- End If
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|