예제 #1
0
        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");
        }
예제 #2
0
 public MarkerEventArgs(Marker marker)
 {
     Marker = marker;
 }
예제 #3
0
 public void SetMarkers(Marker[] markers)
 {
     gradientContainer.Markers = markers.ToList();
     gradientContainer.SelectedMarker = gradientContainer.Markers[0];
     gradientContainer.Invalidate();
 }
예제 #4
0
        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;
        }
예제 #5
0
        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;
        }
예제 #6
0
        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);
        }
예제 #7
0
 public Gradient(string name, Marker[] Markers)
 {
     Name = name;
     Markers = Markers;
 }