protected override void OnPaint(PaintEventArgs e) { if (Map == null || Map.Image == null) { return; } // TODO: fix this if (Map.Image.PixelFormat == PixelFormat.Undefined) { log.Error("Map image is broken - bug!"); return; } e.Graphics.DrawImageUnscaled(Map.Image, 0, 0); //Trace.WriteLine("OnPaint " + onPaint++); foreach (IMapTool tool in tools) { if (tool.IsActive) { tool.OnPaint(e); } } SelectTool.OnPaint(e); base.OnPaint(e); }
protected override void OnPaint(PaintEventArgs e) { //HACK: check if this works and then move this code/logic elsewhere if (!DelayedEventHandlerController.FireEvents) { return;//stop painting.. } if (Map == null || Map.Image == null) { return; } // TODO: fix this if (Map.Image.PixelFormat == PixelFormat.Undefined) { Log.Error("Map image is broken - bug!"); return; } e.Graphics.DrawImageUnscaled(Map.Image, 0, 0); foreach (var tool in tools.Where(tool => tool.IsActive)) { tool.OnPaint(e); } SelectTool.OnPaint(e); base.OnPaint(e); }