sharpMap开发中,自定义控件拖动后,会有残影!!求解决方案

qq_34048603 2016-03-23 12:03:07
代码如下:
 private void mapBox1_MouseMove(GeoAPI.Geometries.Coordinate worldPos, MouseEventArgs imagePos)
{
PointF TemplatePos;//用于记录从地图坐标转换到桌面坐标的坐标
int x, y;
this.label1.Text = worldPos.X.ToString("N4") + "/" + worldPos.Y.ToString("N4");
this.label2.Text = imagePos.X.ToString("N4") + "/" + imagePos.Y.ToString("N4");
if (IsMousedowm)
{
TemplatePos = mapBox1.Map.WorldToImage(MouseoldPos);
x = (int)TemplatePos.X;
y = (int)TemplatePos.Y;
a.orgPointLable.X = x;
a.orgPointLable.Y = y;
a.Location = new Point(x, y);
mapBox1.Refresh();
}
}

private void mapBox1_MouseDown(GeoAPI.Geometries.Coordinate worldPos, MouseEventArgs imagePos)
{
float x, y;
x = a.orgPointLable.X;
y = a.orgPointLable.Y;
IsMousedowm = true;
MouseoldPos = mapBox1.Map.ImageToWorld(new PointF(x, y));
}

显示的效果是这样:
这些红色控件是复制的,里面是有属性的。求大神指教!1
...全文
179 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

111,129

社区成员

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

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

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