public GradientBuilder() { InitializeComponent(); Marker startMarker = new Marker(Color.Red, 0.0f); Marker endMarker = new Marker(Color.Green, 1.0f); gradientContainer.Markers = new List<Marker> {startMarker, endMarker}; gradientContainer.SelectedMarkerChanged += GradientContainerSelectedMarkerChanged; gradientContainer.OffsetChanging += GradientContainerOffsetChanging; gradientContainer.SelectedMarker = startMarker; gradientContainer.OffsetChanged += GradientContainerOffsetChanged; gradientContainer.MarkersChanged += GradientContainerMarkersChanged; // Tooltip data toolTip.SetToolTip(cmdDel, "Delete selected Marker"); toolTip.SetToolTip(cmdColorWheel, "Open color wheel"); toolTip.SetToolTip(tbHexColor, "Color ARGB in hexadecimal value"); toolTip.SetToolTip(ctlOffset, "Selected Marker offset"); }
public MarkerEventArgs(Marker marker) { Marker = marker; }
public void SetMarkers(Marker[] markers) { gradientContainer.Markers = markers.ToList(); gradientContainer.SelectedMarker = gradientContainer.Markers[0]; gradientContainer.Invalidate(); }
public static Marker[] ConvertToMarkers(GradientStop[] gradient) { Marker[] markers = new Marker[gradient.Length]; for (int i = 0; i < gradient.Length; i++) { GradientStop gradientStop = gradient[i]; markers[i] = new Marker(gradientStop.Color.ToColor(), gradientStop.Offset); } return markers; }
public static GradientStop[] ConvertToGradientStop(Marker[] markers) { GradientStop[] gradient = new GradientStop[markers.Length]; for (int i = 0; i < markers.Length; i++) { Marker marker = markers[i]; gradient[i] = new GradientStop(marker.Color, marker.Offset); } return gradient; }
private void GradientContainerDoubleClick(object sender, EventArgs e) { MouseEventArgs me = (MouseEventArgs)e; int xLocation = me.X - 2 * TriangleHalfSize; float offset = xLocation / (float)gradientRectangle.Width; Marker newMarker = new Marker(Color.Red, offset); Markers.Add(newMarker); SelectedMarker = newMarker; SortMarkers(); Invalidate(); OnMarkersChanged(e); }
public Gradient(string name, Marker[] Markers) { Name = name; Markers = Markers; }