C# Windows Mobile Guidebee map添加覆盖物

boonya
博客专家认证
2014-08-14 05:28:03
如题所示,我安照API来实现但是地图上显示不出来。地图图片是采用的Graphic绘图方式实现的,但是地图上去始终看不到东西,卡在这里很久了也不知道该怎么解决。

我仿照Java版本编码的方式分析添加步骤如下:
1、Graphic绘图(工具:Brush、Pen)
2、将Graphic对象添加到MapLayer
3、将MapLayer设置到地图对象上

经过以上的处理之后一般地图就会显示出来了,但是我这里显示不出来我所要绘制的图形。如下图:

上面是因为什么原因而不显示呢?
...全文
111 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
boonya 2014-08-18
  • 打赏
  • 举报
回复
主要的问题是Graphics的图形看不见,请知道的兄台指点下!单纯的Graphic绘图代码如下:
 private void DrawGraphic(PaintEventArgs e) 
        {
            Graphics g = e.Graphics;

            // Opaque colors (alpha value defaults to 255 -- max value).
            Color red = Color.FromArgb(255, 0, 0);
            Color green = Color.FromArgb(0, 255, 0);
            Color blue = Color.FromArgb(0, 0, 255);

            // Solid brush initialized to red.
            SolidBrush myBrush = new SolidBrush(green);
            int alpha;

            // x coordinate of first red rectangle
            int x = 50;

            // y coordinate of first red rectangle
            int y = 50;

            // Fill rectangles with red, varying the alpha value from 25 to 250.
            for (alpha = 25; alpha <= 250; alpha += 25)
            {
                myBrush.Color = red;
                g.FillRectangle(myBrush, x, y, 50, 100);
                g.FillRectangle(myBrush, x, y + 250, 50, 50);
                x += 50;
            }
        }
boonya 2014-08-18
  • 打赏
  • 举报
回复
没人研究过吗?

110,500

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧