Ejemplo n.º 1
0
 private void GradientPanel_MouseDown(object sender, MouseEventArgs e)
 {
     if (CurrentGradient == null)
     {
         return;
     }
     activeGradientColorEntry = GetGradientColorEntryFromLocation(e.X);
     if (activeGradientColorEntry != null)
     {
         if (e.Button == MouseButtons.Left)
         {
             // drag
             draggingGradientColorEntryNow = true;
         }
         else if (e.Button == MouseButtons.Right)
         {
             // delete
             CurrentGradient.ColorEntries.Remove(activeGradientColorEntry);
         }
     }
     else
     {
         if (e.Button == MouseButtons.Left)
         {
             // add
             double location = GetColorEntryLocationFromX(e.X);
             Color  color    = CurrentGradient.GetColor(location);
             CurrentGradient.ColorEntries.Add(new GradientColorEntry(color, location));
         }
     }
     DrawGradient();
     CopyBackBufferToScreen();
 }
Ejemplo n.º 2
0
 private void GradientPanel_MouseMove(object sender, MouseEventArgs e)
 {
     if (CurrentGradient == null)
     {
         return;
     }
     if (draggingGradientColorEntryNow)
     {
         // drag gradient color entry
         activeGradientColorEntry.Location = GetColorEntryLocationFromX(e.X);
         DrawGradient();
         CopyBackBufferToScreen();
     }
     else
     {
         // check if mouse pointer is over gradient entry marker
         GradientColorEntry previousActiveGradientColorEntry = activeGradientColorEntry;
         activeGradientColorEntry = GetGradientColorEntryFromLocation(e.X);
         if ((previousActiveGradientColorEntry != null && !previousActiveGradientColorEntry.Equals(activeGradientColorEntry))
             ||
             (activeGradientColorEntry != null && !activeGradientColorEntry.Equals(previousActiveGradientColorEntry)))
         {
             DrawColorEntryMarkers();
             CopyBackBufferToScreen();
         }
     }
 }
Ejemplo n.º 3
0
 private void GradientPanel_MouseLeave(object sender, EventArgs e)
 {
     if (CurrentGradient == null)
     {
         return;
     }
     activeGradientColorEntry = null;
     DrawColorEntryMarkers();
 }
Ejemplo n.º 4
0
 private void GradientPanel_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (CurrentGradient == null)
     {
         return;
     }
     activeGradientColorEntry = GetGradientColorEntryFromLocation(e.X);
     if (activeGradientColorEntry != null)
     {
         GradientColorEntry colorEntry = activeGradientColorEntry;
         using (var cc = new ColorChooser {
             Color = colorEntry.Color
         })
         {
             if (cc.ShowDialog() == DialogResult.OK)
             {
                 colorEntry.Color = cc.Color;
                 DrawGradient();
                 CopyBackBufferToScreen();
             }
         }
     }
 }
Ejemplo n.º 5
0
 private void GradientPanel_MouseMove(object sender, MouseEventArgs e)
 {
     if (CurrentGradient == null) return;
       if (draggingGradientColorEntryNow)
       {
     // drag gradient color entry
     activeGradientColorEntry.Location = GetColorEntryLocationFromX(e.X);
     DrawGradient();
     CopyBackBufferToScreen();
       }
       else
       {
     // check if mouse pointer is over gradient entry marker
     GradientColorEntry previousActiveGradientColorEntry = activeGradientColorEntry;
     activeGradientColorEntry = GetGradientColorEntryFromLocation(e.X);
     if ((previousActiveGradientColorEntry != null && !previousActiveGradientColorEntry.Equals(activeGradientColorEntry))
     ||
     (activeGradientColorEntry != null && !activeGradientColorEntry.Equals(previousActiveGradientColorEntry)))
     {
       DrawColorEntryMarkers();
       CopyBackBufferToScreen();
     }
       }
 }
Ejemplo n.º 6
0
 private void GradientPanel_MouseLeave(object sender, EventArgs e)
 {
     if (CurrentGradient == null) return;
       activeGradientColorEntry = null;
       DrawColorEntryMarkers();
 }
Ejemplo n.º 7
0
 private void GradientPanel_MouseDown(object sender, MouseEventArgs e)
 {
     if (CurrentGradient == null) return;
       activeGradientColorEntry = GetGradientColorEntryFromLocation(e.X);
       if (activeGradientColorEntry != null)
       {
     if (e.Button == MouseButtons.Left)
     {
       // drag
       draggingGradientColorEntryNow = true;
     }
     else if (e.Button == MouseButtons.Right)
     {
       // delete
       CurrentGradient.ColorEntries.Remove(activeGradientColorEntry);
     }
       }
       else
       {
     if (e.Button == MouseButtons.Left)
     {
       // add
       double location = GetColorEntryLocationFromX(e.X);
       Color color = CurrentGradient.GetColor(location);
       CurrentGradient.ColorEntries.Add(new GradientColorEntry(color, location));
     }
       }
       DrawGradient();
       CopyBackBufferToScreen();
 }
Ejemplo n.º 8
0
 private void GradientPanel_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (CurrentGradient == null) return;
       activeGradientColorEntry = GetGradientColorEntryFromLocation(e.X);
       if (activeGradientColorEntry != null)
       {
     GradientColorEntry colorEntry = activeGradientColorEntry;
     using (var cc = new ColorChooser {Color = colorEntry.Color})
     {
       if (cc.ShowDialog() == DialogResult.OK)
       {
     colorEntry.Color = cc.Color;
     DrawGradient();
     CopyBackBufferToScreen();
       }
     }
       }
 }