|
- Sub 画时钟()
- Dim dicNum As Object, oShape As Object
- Dim nDiam As Double, nPointX As Double, nPointY As Double
- Dim nI As Long, nPai As Double, nX As Double, nY As Double, nWidth As Long, nHeight As Long
-
- nPointX = 210 '图形圆左位置
- nPointY = 100 '图形圆顶位置
- nDiam = 147 '图形圆直径
- With ActiveSheet
- For Each oShape In .Shapes
- oShape.Delete
- Next
-
- With .Shapes.AddShape(msoShapeOval, nPointX, nPointY, nDiam, nDiam)
- Debug.Print .Left & "," & .Top & "," & .Width & "," & .Height
- .Fill.ForeColor.SchemeColor = 10
- .Line.Visible = msoFalse
- .Name = "Oval 1"
- End With
-
- nPointX = nPointX + nDiam / 2
- nPointY = nPointY + nDiam / 2
- nDiam = nDiam + 30 '数字所处直径
- nHeight = 20
- nWidth = 15
- nPai = Application.WorksheetFunction.Pi
- For nI = 1 To 12
- If nI > 9 Then nWidth = 30
- nX = nPointX + nDiam * Cos(nPai / 2 - nI * nPai / 6) / 2 - nWidth / 2
- nY = nPointY - nDiam * Sin(nPai / 2 - nI * nPai / 6) / 2 - nHeight / 2
- With .Shapes.AddTextbox(msoTextOrientationHorizontal, nX, nY, nWidth, nHeight)
- With .TextFrame.Characters
- .Text = nI
- .Font.Size = 12
- .Font.FontStyle = "加粗"
- End With
- .Line.Visible = msoFalse
- .Name = "文字" & nI
- End With
- Next
- End With
- End Sub
复制代码 |
|