Ejemplo n.º 1
0
 /// <summary>
 /// The MouseDown event of the source control is used to initiate a drag operation.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">A MouseEventArgs that contains the event data.</param>
 private void numericUpDown1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     // Sets a reference to the control that initiated the DragDrop operation, so
     // that the target control can implement logic to handle data dragged from
     // specific controls differently.
     sourceControl = numericUpDown1;
     // Record the mouse button that initiated this operation in order to allow
     // target controls to respond differently to drags with the right or left
     // mouse buttons.
     mouseButton = e.Button;
     // This initiates a DragDrop operation, specifying that the data to be dragged
     // with be the value stored in the numericUpDown1 control.  This also specifies
     // that ONLY the Copy effect will be allowed.
     numericUpDown1.DoDragDrop(numericUpDown1.Value.ToString(), DragDropEffects.Copy);
 }