|
本帖最后由 windows 于 2011-11-16 16:02 编辑
MapxInfo中添加Bmp图符的代码
- CMapXFeature obj,newobj;
- CMapXPoints pts;
- CMapXPoint pt;
- if(!newobj.CreateDispatch(newobj.GetClsid()))
- {
- TRACE0("Failed to create Feature object");
- return;
- }
- if(!pts.CreateDispatch(pts.GetClsid()))
- {
- TRACE0("Failed to create Points collection");
- return;
- }
- if(!pt.CreateDispatch(pt.GetClsid()))
- {
- TRACE0("Failed to create Point object");
- return;
- }
-
- newobj.Attach(m_ctrlMapX.GetDispatch());
- try {
- newobj = m_ctrlMapX.GetFeatureFactory().CreateSymbol();
-
- CMapXLayer mapxLayer;
- mapxLayer = m_ctrlMapX.GetLayers().Item("Event List");
-
- newobj.GetStyle().SetSymbolType(miSymbolTypeBitmap);
- newobj.GetStyle().SetSymbolBitmapSize(24); // 图形的大小控制
- newobj.GetStyle().SetSymbolBitmapTransparent(FALSE);
- newobj.GetPoint().Set(-101.023,45.0452); // bmp 图显示的位置
- CMapXBitmapSymbols bmps;
- bmps.CreateDispatch(bmps.GetClsid());
- newobj.GetStyle().SetSymbolBitmapName(bmps.Item(15).GetName()); // 显示的图形
-
- obj = mapxLayer.AddFeature(newobj);
- }
- catch (COleDispatchException *e)
- {
- e->ReportError();
- e->Delete();
- }
- catch (COleException *e)
- {
- e->ReportError();
- e->Delete();
- }
复制代码
|
|