示例#1
0
 //select or add faders
 protected override void OnMouseDown(MouseEventArgs e)
 {
     if (_blend != null && e.Button == MouseButtons.Left && !ReadOnly)
     {
         bool foc;
         Selection      = GetFaderUnderMouse(e.Location, ref _offset, out foc);
         FocusSelection = foc;
         if (_selection == null)
         {
             //create new color or alpha point
             Rectangle area = Rectangle.Inflate(this.ClientRectangle, -BORDER, -BORDER);
             double    pos  = PointToPos(e.Location);
             _offset = Point.Empty;
             //
             if (_orientation == Orientation.Horizontal ?
                 e.Y > area.Bottom : e.X > area.Right)
             {
                 ColorPoint pnt = new ColorPoint(_blend.GetColorAt((float)pos), pos);
                 _selection = pnt;
                 _blend.Colors.Add(pnt);
             }
             else if (_orientation == Orientation.Horizontal ?
                      e.Y < area.Y : e.X < area.X)
             {
                 // MS: 25/09/11: disable drawing alpha points, we don't want to use them (yet).
                 //AlphaPoint pnt = new AlphaPoint(_blend.GetColorAt((float)pos).A, pos);
                 //_selection = pnt;
                 //_blend.Alphas.Add(pnt);
             }
         }
     }
     base.OnMouseDown(e);
 }
示例#2
0
 public ModifiedEventArgs(Action action, ColorGradient.Point pt)
 {
     _action = action;
     _pt     = pt;
 }