void surfaceControl_MouseMove(object sender, MouseEventArgs e) { if (initialized) { if (e.Button == MouseButtons.Left) { if (mapViewport.Width + 1 < surface.Width || mapViewport.Height + 1 < surface.Height) { if (onViewChanged != null) { // Copy the data so we can check the bounds Point pos = e.Location; // Check bounds if (pos.X < 0) { pos.X = 0; } if (pos.Y < 0) { pos.Y = 0; } if (pos.X + mapViewport.Width > panel.Width) { pos.X = panel.Width - mapViewport.Width - 1; } if (pos.Y + mapViewport.Height > panel.Height) { pos.Y = panel.Height - mapViewport.Height - 1; } // Set the location of the red box mapViewport.Location = pos; // Draw the box surface = mapSurface.CreateScaledSurface(scaleFactor, true); surface.Draw(mapViewport, Color.Red); this.surfaceControl.Blit(surface); if (onViewChanged != null) { // Invoke the event ViewportEventArgs ea = new ViewportEventArgs(new Rectangle(Convert.ToInt32(e.X / scaleFactor), Convert.ToInt32(e.Y / scaleFactor), Convert.ToInt32(mapViewport.Width / scaleFactor), Convert.ToInt32(mapViewport.Height / scaleFactor))); onViewChanged.Invoke(this, ea); } } } } } }
public void MapViewportChange(object sender, ViewportEventArgs e) { ViewportChanged(e.Rectangle, e.Surface); }
public void MapOpen(object sender, ViewportEventArgs e) { Initialize(e.Surface.Rectangle, e.Rectangle, e.Surface); }
private void infoForm_onViewChanged(object sender, ViewportEventArgs e) { ActiveMdiChild.AutoScrollPosition = e.Rectangle.Location; }
private void MapForm_Load(object sender, EventArgs e) { if (onOpen != null) { ViewportEventArgs ea = new ViewportEventArgs(this.mapSurface.Rectangle, this.mapSurface); onOpen.Invoke(this, ea); } }
public void InvokeViewChange() { if (mapViewportChange != null) { ViewportEventArgs ea = new ViewportEventArgs(new Rectangle(-this.DisplayRectangle.X, -this.DisplayRectangle.Y, this.Width, this.Height), this.mapSurface); mapViewportChange.Invoke(this, ea); } }