示例#1
0
 private bool gotoMap(string mapId)
 {
     if (NgMaps == null)
     {
         curMap = null;
         curMapImage = null;
         curPoint = null;
         return false;
     }
     var map2b = NgMaps.FirstOrDefault(x => x.id == mapId);
     if (map2b == null)
         return false;
     curMap = map2b;
     var imgPath = Path.Combine(ImageFolderRelativePath, curMap.img);
     curMapImage = Image.FromFile(imgPath);
     return true;
 }
示例#2
0
        private void MapImmitator_MouseLeave(object sender, EventArgs e)
        {
            curPoint = null;

        }
示例#3
0
 private bool IntersectsMouse(NgMapObjPoint point, MouseEventArgs e)
 {
     var x = (float)(Width * point.x / 100);
     var y = (float)(Height * point.y / 100);
     return (e.X >= x - DotRadius && e.X <= x + DotRadius &&
             e.Y >= y - DotRadius && e.Y <= y + DotRadius);
 }
示例#4
0
 private void MapImmitator_MouseUp(object sender, MouseEventArgs e)
 {
     string idMapChange = null;
     if (isUpHover)
         idMapChange = curMap.backLink;
     else if (curPoint != null)
         idMapChange = curPoint.href;
     if (idMapChange == null)
         return;
     var mapGoOk = gotoMap(idMapChange);
     if (!mapGoOk)
         idMapChange = String.Format("FINISH-POINT:{0},{1},{2}", curPoint.x, curPoint.y, curPoint.label);
     // ... fire map changed event for all subsequent clicks
     if (MapChanged != null)
         MapChanged(idMapChange);
     curPoint = null;
 }
示例#5
0
 private void MapImmitator_MouseMove(object sender, MouseEventArgs e)
 {
     if (curMap == null)
         return;
     curPoint = curMap.points.LastOrDefault(p => IntersectsMouse(p, e));
     isUpHover = (e.X < 90 && e.Y < 60);
     Invalidate();
 }