读书人

在MFC中怎么获取powerpoint幻灯片里面

发布时间: 2013-09-07 14:12:44 作者: rapoo

在MFC中如何获取powerpoint幻灯片里面某一个图形的各个节点坐标?

msppt::ShapeNodesPtr shapeNodes = m_pCurShape->Nodes;
sPolygon.nCount = shapeNodes->Count;
sPolygon.pPointPtr = (LPPOINT)malloc(sPolygon.nCount*sizeof(POINT));
LPPOINT pLPoint = sPolygon.pPointPtr;

for (int i = 1; i <= sPolygon.nCount; i++)
{
VARIANT *piont;
msppt::ShapeNodePtr shapenode = shapeNodes->Item(i);
shapenode->get_Points(piont);
}


piont值一直为空
另外,如何将pong转换成LPPOINT类型的坐标? MFC C++ PowerPoint
[解决办法]
引用:
Sub GetPoint()

Dim shpTemp As Shape
Dim pointsArray As Variant
Dim currXvalue As Currency
Dim currYvalue As Currency

Set shpTemp = Application.ActivePresentation.Slides.Item(1).Shapes(1)

With shpTemp
If .Type = msoFreeform Then
With .Nodes
Debug.Print .Count
pointsArray = .Item(1).Points
currXvalue = pointsArray(1, 1)
currYvalue = pointsArray(1, 2)
Debug.Print currXvalue, currYvalue

currXvalue = .Item(2).Points(1, 1)


currYvalue = .Item(2).Points(1, 2)
Debug.Print currXvalue, currYvalue
End With
ElseIf .Type = msoAutoShape Then
'针对autoshape更改
With .Nodes
Debug.Print .Count
pointsArray = .Item(1).Points
currXvalue = pointsArray(1, 1)
currYvalue = pointsArray(1, 2)
Debug.Print currXvalue, currYvalue

currXvalue = .Item(2).Points(1, 1)
currYvalue = .Item(2).Points(1, 2)
Debug.Print currXvalue, currYvalue
End With
End If

End With

End Sub


上面是我在VBA里面对msoFreeform图形和msoAutoShape图形的节点坐标访问,结果是msoFreeform类型的可以,msoAutoShape类型的无法访问。
请问有谁知道如何访问msoAutoShape图形的各个节点坐标吗?


left,top这几个属性不行吗?
[解决办法]
对于你说的其它类型的图形,就需要通过数学公式取坐标了。
[解决办法]
autoshape没有node,如果一定要,只能自己把图拷到内存中,然后用图形识别技术,自己分析图形的几何特征,然后识别出图形类型,然后再自己通过计算,得到节点,这个工作量太大,一般人吃不消啊。

读书人网 >VBA

热点推荐