private void FrameImage_MouseMove(object sender, MouseEventArgs e) { if (_draw) { _sprite.SpriteBase.X2 = (short)(e.X / _zoom); _sprite.SpriteBase.Y2 = (short)(e.Y / _zoom); WHLabel.Text = "W, H = (" + (_sprite.SpriteBase.Width + 1) + ", " + (_sprite.SpriteBase.Height + 1) + ")"; FrameImage.Refresh(); } }
private void FrameImage_MouseUp(object sender, MouseEventArgs e) { _draw = false; _sprite.SpriteBase.X2 = Math.Max((short)(_sprite.SpriteBase.X1 + 1), _sprite.SpriteBase.X2); _sprite.SpriteBase.Y2 = Math.Max((short)(_sprite.SpriteBase.Y1 + 1), _sprite.SpriteBase.Y2); if (Modified != null) { Modified(this, new EventArgs()); } FrameImage.Refresh(); }
public void UpdateCenterFrame() { if (_sprite != null) { _zoom = BasePanel.Width / _sprite.SpriteWidth; _zoom = Math.Min(BasePanel.Height / _sprite.SpriteHeight, _zoom); FrameImage.Width = _sprite.SpriteWidth * _zoom; FrameImage.Height = _sprite.SpriteHeight * _zoom; } int x = (BasePanel.Width >> 1) - (FrameImage.Width >> 1); int y = (BasePanel.Height >> 1) - (FrameImage.Height >> 1); FrameImage.Location = new Point(x, y); FrameImage.Refresh(); }