Ejemplo n.º 1
0
        /// <summary>
        /// Draws the <see cref="CanvasPoint"/>
        /// </summary>
        public override void Draw(Graphics graphics)
        {
            if (!Visible)
            {
                return;
            }
            var imageCenter  = new Point(Image.Width / 2, Image.Height / 2);
            var topLeftPoint = ToPoint.Subtract(imageCenter);

            graphics.DrawImage(Image, topLeftPoint);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Call to check if the mouse is over this <see cref="CanvasPoint"/>
        /// </summary>
        /// <returns><see cref="CanvasPoint"/> when mouse is over the this</returns>
        public override CanvasObject MouseOver(Point mousePosition, Keys modifierKeys)
        {
            var width  = Image.Width;
            var height = Image.Height;

            var topLeftPoint = ToPoint.Subtract(new Point(width / 2, height / 2));
            var path         = new GraphicsPath();

            path.AddEllipse(topLeftPoint.X, topLeftPoint.Y, width, height);
            return(path.IsVisible(mousePosition) ? this : null);
        }