/// <summary> /// Sets the current paint operation of this InternalPictureBox to be of the given type /// </summary> /// <param name="newPaintTool"></param> public void SetPaintOperation(IPaintTool newPaintTool) { if (_currentPaintTool != null) { _owningPanel.FireOperationStatusEvent(_currentPaintTool, ""); _currentPaintTool.Destroy(); } _currentPaintTool = newPaintTool; if (Image != null) { _currentPaintTool.Initialize(this); if (!_mouseOverImage) { _currentPaintTool.MouseLeave(new EventArgs()); } Cursor = _currentPaintTool.ToolCursor; } var operation = _currentPaintTool as ICompositingPaintTool; if (operation != null) { operation.CompositingMode = _owningPanel._defaultCompositingMode; } if (_currentPaintTool is IFillModePaintTool) { (_currentPaintTool as IFillModePaintTool).FillMode = _owningPanel._defaultFillMode; } }
// // Mouse Leave event handler // protected override void OnMouseLeave(EventArgs e) { base.OnMouseLeave(e); _mouseOverImage = false; if (Image != null) { _currentPaintTool.MouseLeave(e); } }