Пример #1
0
 /// <summary>
 /// Constructeur
 /// </summary>
 /// <param name="location">localisation actuelle de la souris en coordonnées client</param>
 /// <param name="startLocation">localisation en coordonnées client de l'impact initial</param>
 /// <param name="startArea">région du cadre de sélection concerné par l'impact initial</param>
 /// <param name="startDelta">différence entre la localisation du composant et l'impact souris initial</param>
 /// <param name="control">contrôle concerné par l'impact initial</param>
 public DragDetectEventArgs( Point location, Point startLocation, SelectorArea startArea, Size startDelta, Control control ) {
   Location = location;
   StartLocation = startLocation;
   StartArea = startArea;
   StartDelta = startDelta;
   Control = control;
 }
Пример #2
0
 // constructeur pour une poignée
 public AreaData( SelectorArea direction, Cursor cursor, int handleSize, int x, int y )
   : this( direction, cursor, x, y, handleSize, handleSize ) {
 }
Пример #3
0
    /// <summary>
    /// Surveillance des événements souris : lorsque la souris est déplacée
    /// </summary>
    /// <param name="e">descripteur de l'événement</param>
    protected override void OnMouseMove( MouseEventArgs e ) {
      DragState oldState = dragState;
      try {
        switch ( dragState ) {

          // surveillance de détection d'une amorce de glissement
          case DragState.Watching:
            Rectangle dragDetect = new Rectangle( Point.Subtract( dragHitLocation, new Size( DragDetectArea, DragDetectArea ) ), new Size( 2 * DragDetectArea, 2 * DragDetectArea ) );
            if ( dragDetect.Contains( e.Location ) ) return;

            dragState = DragState.None;
            Control control = GetChildAtPoint( dragHitLocation );
            if ( control == null ) return;
            SelectedControl = control;
            dragHitDelta = new Size( control.Location.X - dragHitLocation.X, control.Location.Y - dragHitLocation.Y );
            dragHitArea = AreaEnumOf( dragHitLocation );
            dragLastLocation = dragHitLocation;
            dragState = DragState.Dragging;
            OnDragDetect( new DragDetectEventArgs( e.Location, dragHitLocation, dragHitArea, dragHitDelta, control ) );
            break;

          // glissement ou redimensionnement en cours
          case DragState.Dragging:
            PerformDrag( e.Location );
            break;
        }
      }
      finally {
        DoUpdateCursor( e.Location, e.Button );
        if ( oldState != dragState ) Invalidate();
        base.OnMouseMove( e );
      }
    }
Пример #4
0
 // constructeur pour un rectangle
 public AreaData( SelectorArea area, Cursor cursor, int x, int y, int w, int h )
   : this() {
   Area = area;
   Cursor = cursor;
   Bounds = new Rectangle( x, y, w, h );
 }
Пример #5
0
 // indexeur pour faciliter l'accès aux régions
 private AreaData this[ SelectorArea area ] {
   get { return selectedAreas[ (int) area ]; }
   set { selectedAreas[ (int) area ] = value; }
 }