请教VC控制Word画曲线
这个问题前面都是有人问过,但没人解答,不知道那位兄弟是否已经有答案了?word2003录制的代码为:
With ActiveDocument.Shapes.BuildFreeform(msoEditingAuto, 117#, 306#)
.AddNodes msoSegmentCurve, msoEditingAuto, 126#, 228#
.AddNodes msoSegmentCurve, msoEditingAuto, 144#, 306#
.AddNodes msoSegmentCurve, msoEditingAuto, 153#, 235.8
.AddNodes msoSegmentCurve, msoEditingAuto, 162#, 306#
.AddNodes msoSegmentCurve, msoEditingAuto, 189#, 228#
.AddNodes msoSegmentCurve, msoEditingAuto, 207#, 306#
.AddNodes msoSegmentCurve, msoEditingAuto, 225#, 235.8
.ConvertToShape.Select
End With
End Sub
在vc中对应的类是
/////////////////////////////////////////////////////////////////////////////
// Shapes wrapper class
class Shapes : public COleDispatchDriver
{
public:
Shapes() {}// Calls COleDispatchDriver default constructor
Shapes(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
Shapes(const Shapes& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
LPDISPATCH GetApplication();
long GetCreator();
LPDISPATCH GetParent();
long GetCount();
LPUNKNOWN Get_NewEnum();
LPDISPATCH Item(VARIANT* Index);
LPDISPATCH AddCallout(long Type, float Left, float Top, float Width, float Height, VARIANT* Anchor);
LPDISPATCH AddCurve(VARIANT* SafeArrayOfPoints, VARIANT* Anchor);
LPDISPATCH AddLabel(long Orientation, float Left, float Top, float Width, float Height, VARIANT* Anchor);
LPDISPATCH AddLine(float BeginX, float BeginY, float EndX, float EndY, VARIANT* Anchor);
LPDISPATCH AddPicture(LPCTSTR FileName, VARIANT* LinkToFile, VARIANT* SaveWithDocument, VARIANT* Left, VARIANT* Top, VARIANT* Width, VARIANT* Height, VARIANT* Anchor);
LPDISPATCH AddPolyline(VARIANT* SafeArrayOfPoints, VARIANT* Anchor);
LPDISPATCH AddShape(long Type, float Left, float Top, float Width, float Height, VARIANT* Anchor);
LPDISPATCH AddTextEffect(long PresetTextEffect, LPCTSTR Text, LPCTSTR FontName, float FontSize, long FontBold, long FontItalic, float Left, float Top, VARIANT* Anchor);
LPDISPATCH AddTextbox(long Orientation, float Left, float Top, float Width, float Height, VARIANT* Anchor);
LPDISPATCH BuildFreeform(long EditingType, float X1, float Y1);
LPDISPATCH Range(VARIANT* Index);
void SelectAll();
LPDISPATCH AddOLEObject(VARIANT* ClassType, VARIANT* FileName, VARIANT* LinkToFile, VARIANT* DisplayAsIcon, VARIANT* IconFileName, VARIANT* IconIndex, VARIANT* IconLabel, VARIANT* Left, VARIANT* Top, VARIANT* Width, VARIANT* Height,
VARIANT* Anchor);
LPDISPATCH AddOLEControl(VARIANT* ClassType, VARIANT* Left, VARIANT* Top, VARIANT* Width, VARIANT* Height, VARIANT* Anchor);
LPDISPATCH AddDiagram(long Type, float Left, float Top, float Width, float Height, VARIANT* Anchor);
LPDISPATCH AddCanvas(float Left, float Top, float Width, float Height, VARIANT* Anchor);
};
这个VARIANT* SafeArrayOfPoints参数总是提示超出范围?
[解决办法]
朋友,你遇见的问题我今天也遇见了,能否高诉我一下怎么解决"输入的值超出了范围"这个错误