2014-02-21 125 views
0

我試圖用AddShape使用msoShapeArc繪製半圓。半圓需要觸摸頁面的頂部。爲此,我將y值設置爲-radius。這在C#中使用圖形工作,但excel忽略負的座標並將形狀降爲零。如何在excel VBA中在窗口邊緣繪製半圓

Sub DrawArrowArc(CentX As Single, CentY As Single, radius As Single, Ang1 As Single, Ang2 As Single) 
     Dim Arc  As Shape 
     'Draw 90-degree arc with radius = Radius and center at (CenterX,CenterY) 
     Set Arc = ActiveSheet.Shapes.AddShape(msoShapeArc, CentX, CentY - radius, radius, radius) 
     'Add arrowhead on clockwise end 
     Arc.Line.EndArrowheadStyle = msoArrowheadNone 
     'adjust arrow to start at Ang1 and end at Ang2 
     '(measured clockwise positive from vertical) 
     Arc.Adjustments.Item(1) = 90 - Ang1 
     Arc.Adjustments.Item(2) = 90 - Ang2 
    End Sub 

DrawArrowArc 0, -100, 100, 90, -90 

我願意以不同的方式完成此操作。圓形不需要像形狀一樣是可選擇的或可編輯的,它的圖片可以做得很好。

它需要在飛行中繪製。

它是一個完美的半圓。壓扁它是不可接受的。

那麼你怎麼看?

回答

0

這畫一個半圓在左上角:

Call DrawArrowArc(0, -100, 100, -90, 90)