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(); }
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(); } } }
private void GradientPanel_MouseLeave(object sender, EventArgs e) { if (CurrentGradient == null) { return; } activeGradientColorEntry = null; DrawColorEntryMarkers(); }
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(); } } } }
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(); } } }
private void GradientPanel_MouseLeave(object sender, EventArgs e) { if (CurrentGradient == null) return; activeGradientColorEntry = null; DrawColorEntryMarkers(); }
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(); }
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(); } } } }