/// <summary>
    ///   Raises the <see cref="Selecting" /> event.
    /// </summary>
    /// <param name="e">
    ///   The <see cref="System.EventArgs" /> instance containing the event data.
    /// </param>
    protected virtual void OnSelecting(ImageBoxCancelEventArgs e)
    {
      EventHandler<ImageBoxCancelEventArgs> handler;

      handler = this.Selecting;

      if (handler != null)
        handler(this, e);
    }
    /// <summary>
    /// Initializes a selection or drag operation.
    /// </summary>
    /// <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param>
    protected virtual void StartDrag(MouseEventArgs e)
    {
      ImageBoxCancelEventArgs args;

      args = new ImageBoxCancelEventArgs(e.Location);

      this.OnSelecting(args);

      this.WasDragCancelled = args.Cancel;
      this.IsSelecting = !args.Cancel;
      if (this.IsSelecting)
        _startMousePosition = e.Location;
    }
Example #3
0
        /// <summary>
        ///   Raises the <see cref="ImageBox.Selecting" /> event.
        /// </summary>
        /// <param name="e">
        ///   The <see cref="System.EventArgs" /> instance containing the event data.
        /// </param>
        protected override void OnSelecting(ImageBoxCancelEventArgs e)
        {
            e.Cancel = this.IsMoving || this.IsResizing || this.SelectionRegion.Contains(this.PointToImage(e.Location)) || this.HitTest(e.Location) != DragHandleAnchor.None;

            base.OnSelecting(e);
        }