mapx使用经验(C#版)(未完成...)


一。可以动态生成Map
1AxMapXLib.AxMap map = new AxMapXLib.AxMap();
2map.Layers.RemoveAll();
3map.Parent = this;
4map.Layers.Add(strFileName);


必须设置map.Parent = this;

否则不能显示。

二。很多组件使用标准动态链接库处理字体,颜色。
程序集为stdole.dll

stdole中使用BGR表示颜色。
而组件mapx,maplbjects很多地方使用RGB表示颜色
dotnet使用Argb表示颜色。

 1using stdole;
 2uint ArgbToBgr(System.Drawing.Color argb)
 3{
 4uint r = argb.R;
 5uint g = argb.G;
 6uint b = argb.B;
 7uint color = r|(g<<8)|(b<<16);
 8return color;
 9}

10
11uint RgbToBgr(uint rgb)
12{
13uint r = (rgb>>16)|0xFF;
14uint g = (rgb>>8)|0xFF;
15uint b = rgb|0xFF;
16uint color = r|(g<<8)|(b<<16);
17return color;
18}

19uint BgrToRgb(uint bgr)
20{
21return RgbToBgr(bgr);
22}

23


还有在mapx和mapobjects 中都用stdole.IFont 表示字体。
原文地址:https://www.cnblogs.com/xiexiaokui/p/159725.html