mapx使用经验(C#版)(未完成...)
一。可以动态生成Map
1
AxMapXLib.AxMap map = new AxMapXLib.AxMap();
2
map.Layers.RemoveAll();
3
map.Parent = this;
4
map.Layers.Add(strFileName);
AxMapXLib.AxMap map = new AxMapXLib.AxMap();2
map.Layers.RemoveAll();3
map.Parent = this;4
map.Layers.Add(strFileName);
必须设置map.Parent = this;
否则不能显示。
二。很多组件使用标准动态链接库处理字体,颜色。
程序集为stdole.dll
stdole中使用BGR表示颜色。
而组件mapx,maplbjects很多地方使用RGB表示颜色
dotnet使用Argb表示颜色。
1
using stdole;
2
uint ArgbToBgr(System.Drawing.Color argb)
3
{
4
uint r = argb.R;
5
uint g = argb.G;
6
uint b = argb.B;
7
uint color = r|(g<<8)|(b<<16);
8
return color;
9
}
10
11
uint RgbToBgr(uint rgb)
12
{
13
uint r = (rgb>>16)|0xFF;
14
uint g = (rgb>>8)|0xFF;
15
uint b = rgb|0xFF;
16
uint color = r|(g<<8)|(b<<16);
17
return color;
18
}
19
uint BgrToRgb(uint bgr)
20
{
21
return RgbToBgr(bgr);
22
}
23
using stdole;2
uint ArgbToBgr(System.Drawing.Color argb)3
{4
uint r = argb.R;5
uint g = argb.G;6
uint b = argb.B;7
uint color = r|(g<<8)|(b<<16);8
return color;9
}10

11
uint RgbToBgr(uint rgb)12
{13
uint r = (rgb>>16)|0xFF;14
uint g = (rgb>>8)|0xFF;15
uint b = rgb|0xFF;16
uint color = r|(g<<8)|(b<<16);17
return color;18
}19
uint BgrToRgb(uint bgr)20
{21
return RgbToBgr(bgr);22
}23

还有在mapx和mapobjects 中都用stdole.IFont 表示字体。


浙公网安备 33010602011771号