C++接口IGraphicContainer::FindFrame函数参数VARIANT frameObject怎么用?
我在C++环境下调用arcengine10.1,使用PageLayoutControl控件显示地图,现在要添加一个图例,根据C#例子代码如下,需要调用IGraphicContainer::FindFrame函数,但是该函数C++版本参数为:
FindFrame ( VARIANT frameObject, struct IFrameElement * * frame ),第一个变体参数不知道要什么格式,当前激活地图pActiveView.FocusMap也无法获取此类参数,请问怎么处理?
IActiveView pActiveView = pageLayout as IActiveView;
IGraphicsContainer container = pageLayout as IGraphicsContainer;
// 获得MapFrame
IMapFrame mapFrame = container.FindFrame(pActiveView.FocusMap) as IMapFrame;
//根据MapSurround的uid,创建相应的MapSurroundFrame和MapSurround
UID uid = new UIDClass();
uid.Value = "esriCarto.Legend";
IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(uid, null);
//设置图例的Title
ILegend2 legend = mapSurroundFrame.MapSurround as ILegend2;
legend.Title = "地图图例";
ILegendFormat format = new LegendFormatClass();
ITextSymbol symbol = new TextSymbolClass();
symbol.Size = 4;
format.TitleSymbol = symbol;
legend.Format = format;
//QI,确定mapSurroundFrame的位置
IElement element = mapSurroundFrame as IElement;
IEnvelope envelope = new EnvelopeClass();
envelope.PutCoords(2, 2, 8, 8);
element.Geometry = envelope;
//使用IGraphicsContainer接口添加显示
container.AddElement(element, 0);
pActiveView.Refresh();
FindFrame ( VARIANT frameObject, struct IFrameElement * * frame ),第一个变体参数不知道要什么格式,当前激活地图pActiveView.FocusMap也无法获取此类参数,请问怎么处理?
IActiveView pActiveView = pageLayout as IActiveView;
IGraphicsContainer container = pageLayout as IGraphicsContainer;
// 获得MapFrame
IMapFrame mapFrame = container.FindFrame(pActiveView.FocusMap) as IMapFrame;
//根据MapSurround的uid,创建相应的MapSurroundFrame和MapSurround
UID uid = new UIDClass();
uid.Value = "esriCarto.Legend";
IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(uid, null);
//设置图例的Title
ILegend2 legend = mapSurroundFrame.MapSurround as ILegend2;
legend.Title = "地图图例";
ILegendFormat format = new LegendFormatClass();
ITextSymbol symbol = new TextSymbolClass();
symbol.Size = 4;
format.TitleSymbol = symbol;
legend.Format = format;
//QI,确定mapSurroundFrame的位置
IElement element = mapSurroundFrame as IElement;
IEnvelope envelope = new EnvelopeClass();
envelope.PutCoords(2, 2, 8, 8);
element.Geometry = envelope;
//使用IGraphicsContainer接口添加显示
container.AddElement(element, 0);
pActiveView.Refresh();
0 个回复