谁用过ActiveDocument.Shapes.AddCurve,进来帮帮我

jam021 2004-07-20 11:23:40
我在word的宏里写了一段代码,执行后画了一条拐弯的线,可我不知道代码中的7个点是怎么控制线的,请大家帮忙,代码如下:
Dim pts(1 To 7, 1 To 2) As Single
pts(1, 1) = 0
pts(1, 2) = 0
pts(2, 1) = 0
pts(2, 2) = 0
pts(3, 1) = 100
pts(3, 2) = 100
pts(4, 1) = 0
pts(4, 2) = 0
pts(5, 1) = 90
pts(5, 2) = 120
pts(6, 1) = 60
pts(6, 2) = 30
pts(7, 1) = 150
pts(7, 2) = 90

ActiveDocument.Shapes.AddCurve pts

End Sub
...全文
347 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
jam021 2004-07-26
  • 打赏
  • 举报
回复
自己顶一下
jam021 2004-07-20
  • 打赏
  • 举报
回复
tech兄,word里的帮助我是看过,可以由于偶的英文水平实在是!@$#&,所以就发个帖子来问问大家,呵呵,不过还是谢谢你,我去找人帮我把这段话翻译过来,大家有谁还用过的就给我点经验吧,省的偶看英文了,呵呵
sanyou98 2004-07-20
  • 打赏
  • 举报
回复
up
techgopher 2004-07-20
  • 打赏
  • 举报
回复
Word帮助里讲的很清楚啊:

expression.AddCurve(SafeArrayOfPoints, Anchor)
expression Required. An expression that returns a Shapes object.

SafeArrayOfPoints Required Variant. An array of coordinate pairs that specifies the vertices and control points of the curve. The first point you specify is the starting vertex, and the next two points are control points for the first Bézier segment. Then, for each additional segment of the curve, you specify a vertex and two control points. The last point you specify is the ending vertex for the curve. Note that you must always specify 3n + 1 points, where n is the number of segments in the curve.

至于那个线(Bézier Curve)怎么画出来的,控制点怎么设,在网上找找就好了。比如我看了这个网页就有了个大致的概念:http://www.moshplant.com/direct-or/bezier/。 不过有问题别问我啊,我也是现炒现卖,:-)
ppt一页9张最佳打印法,下面是代码 Attribute VB_Name = "NewMacros" Sub PPT最优打印自动排版() Attribute PPT最优打印自动排版.VB_Description = "宏在 2008-6-16 由 欣宇 录制" Attribute PPT最优打印自动排版.VB_ProcData.VB_Invoke_Func = "Normal.NewMacros.Macro1" ' '【调整页边距及页眉页脚距,适用于A4纸】 With ActiveDocument.Styles(wdStyleNormal).Font If .NameFarEast = .NameAscii Then .NameAscii = "" End If .NameFarEast = "" End With With ActiveDocument.PageSetup .LineNumbering.Active = False .Orientation = wdOrientPortrait .TopMargin = CentimetersToPoints(1.6) .BottomMargin = CentimetersToPoints(0.9) .LeftMargin = CentimetersToPoints(1.4) .RightMargin = CentimetersToPoints(1) .Gutter = CentimetersToPoints(0) .HeaderDistance = CentimetersToPoints(0.5) .FooterDistance = CentimetersToPoints(0.9) .PageWidth = CentimetersToPoints(21) .PageHeight = CentimetersToPoints(29.7) .FirstPageTray = wdPrinterDefaultBin .OtherPagesTray = wdPrinterDefaultBin .SectionStart = wdSectionNewPage .OddAndEvenPagesHeaderFooter = False .DifferentFirstPageHeaderFooter = False .VerticalAlignment = wdAlignVerticalTop .SuppressEndnotes = False .MirrorMargins = False .TwoPagesOnOne = False .BookFoldPrinting = False .BookFoldRevPrinting = False .BookFoldPrintingSheets = 1 .GutterPos = wdGutterPosLeft .LayoutMode = wdLayoutModeLineGrid End With '【加页码,页脚居中处】 Selection.Sections(1).Footers(1).PageNumbers.Add PageNumberAlignment:= _ wdAlignPageNumberCenter, FirstPage:=True If ActiveWindow.View.SplitSpecial <> wdPaneNone Then ActiveWindow.Panes(2).Close End If If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _ ActivePane.View.Type = wdOutlineView Then ActiveWindow.ActivePane.View.Type = wdPrintView End If ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader If Selection.HeaderFooter.IsHeader = True Then ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter Else ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader End If If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _ ActivePane.View.Type = wdOutlineView Then If ActiveWindow.Panes.Count = 2 Then ActiveWindow.Panes(2).Close End If ActiveWindow.View.SplitSpecial = wdPaneCurrentPageHeader Else ActiveWindow.View.SeekView = wdSeekCurrentPageHeader End If ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument ActiveWindow.ActivePane.VerticalPercentScrolled = 0 '【调整每张幻灯片的大小为高184宽262,也许还有更佳的值,可自己尝试】 Dim i As Integer For i = 1 To ActiveDocument.InlineShapes.Count ActiveDocument.InlineShapes(i).Height = 184 ActiveDocument.InlineShapes(i).Width = 262 Next i '【给每张幻灯片加边框,感觉没有边框很难看】 Selection.HomeKey Unit:=wdStory Dim j As Integer For j = 1 To ActiveDocument.InlineShapes.Count Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend With Selection.InlineShapes(1) With .Borders(wdBorderLeft) .LineStyle = wdLineStyleSingle .LineWidth = wdLineWidth050pt .Color = wdColorAutomatic End With With .Borders(wdBorderRight) .LineStyle = wdLineStyleSingle .LineWidth = wdLineWidth050pt .Color = wdColorAutomatic End With With .Borders(wdBorderTop) .LineStyle = wdLineStyleSingle .LineWidth = wdLineWidth050pt .Color = wdColorAutomatic End With With .Borders(wdBorderBottom) .LineStyle = wdLineStyleSingle .LineWidth = wdLineWidth050pt .Color = wdColorAutomatic End With .Borders.Shadow = False End With With Options .DefaultBorderLineStyle = wdLineStyleSingle .DefaultBorderLineWidth = wdLineWidth050pt .DefaultBorderColor = wdColorAutomatic End With Selection.MoveRight Unit:=wdCharacter, Count:=1 Next j End Sub

2,461

社区成员

发帖
与我相关
我的任务
社区描述
VBA(Visual Basic for Applications)是Visual Basic的一种宏语言,是在其桌面应用程序中执行通用的自动化(OLE)任务的编程语言。
社区管理员
  • VBA
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧