// 绘制一个空心矩形区域。 CMapXRectangle rec; rec = m_ctrlMapx -> GetBounds(); double x1 = rec.GetXMin(); double y1 = rec.GetYMax(); double x2 = rec.GetXMax(); double y2 = rec.GetYMin(); width = x2 - x1; height = y1 - y2; CMapXPoints points; CMapXPoint point; points.CreateDispatch(points.GetClsid()); point.CreateDispatch(point.GetClsid()); point.Set(x1,y1); points.Add(point); point.Set(x2,y1); points.Add(point); point.Set(x2,y2); points.Add(point); point.Set(x1,y2); points.Add(point); VARIANT v; v.vt = VT_DISPATCH; v.pdispVal = points.m_lpDispatch; v.pdispVal -> AddRef(); CMapXStyle sty; sty.CreateDispatch(sty.GetClsid()); sty.SetRegionBorderWidth( 3 ); sty.SetRegionBorderColor(miColorRed); sty.SetRegionPattern(miPatternNoFill); sty.SetRegionTransparent( 1 ); VARIANT t; t.vt = VT_DISPATCH; t.pdispVal = sty.m_lpDispatch; t.pdispVal -> AddRef(); CMapXFeature ftr; ftr = m_ctrlMapx .GetFeatureFactory().CreateRegion(v,t); lyr.AddFeature(ftr);