Example #1
0
        // Check if the mouse pointer is on the canvas
        private bool IsMouseOnCanvas()
        {
            int x = 0;
            int y = 0;

            // Get the position of the mouse pointer relative
            // to canvas scrolled window top-left corner
            sw.GetPointer(out x, out y);

            // Check if the pointer is on the canvas
            return((x > 0) && (x < sw.Allocation.Width) &&
                   (y > 0) && (y < sw.Allocation.Height));
        }