void InitializeMap() { if (_viewPort != null) { _viewPort.AreaChanged -= _viewPort_AreaChanged; } _zoomValue = 1000; _map = new Map(10, _boxCount); _viewPort = new ViewPort(_map, 5); _viewPort.ShowGridLines = _showGridLines; _viewPort.SetClientSize(ClientSize); _viewPort.AreaChanged += _viewPort_AreaChanged; _viewPort.SetDriver(_zoo); DisplayInfo(); MapWidthChanged?.Invoke(this, _viewPort.Map.MapWidth); Invalidate(); }
void InitializeMap() { var previousViewPort = _viewPort; if (previousViewPort != null) { previousViewPort.AreaChanged -= _viewPort_AreaChanged; } _map = new Map(10, _boxCount); _viewPort = new ViewPort(_map, 5); _viewPort.ShowGridLines = previousViewPort?.ShowGridLines ?? false; _viewPort.SetClientSize(ClientSize); _viewPort.AreaChanged += _viewPort_AreaChanged; _viewPort.SetDriver(_zoo); DisplayInfo(); MapWidthChanged?.Invoke(this, _viewPort.Map.MapWidth); Invalidate(); }
public ZooViewPortControl() { DoubleBuffered = true; _boxCount = 10; _map = new Map(10, 11); _viewPort = new ViewPort(_map, 1); _viewPort.AreaChanged += _viewPort_AreaChanged; _zoomMax = 1000; _zoomMin = 0; _zoomValue = 1000; _zoomScale = 50; _mousePressed = false; _mouseDown = new Point(); _grab = new Cursor("ifm_grab.cur"); _grabbing = new Cursor("ifm_move.cur"); _drawWatch = new Stopwatch(); _zooWatch = new Stopwatch(); _timer = new System.Timers.Timer(); _timer.Elapsed += new ElapsedEventHandler(OnTimedEvent); _timer.Interval = 1000; _timer.Start(); }