public static void selectColorByXValue(LJJSPoint lrptstart, List <LJJSPoint> xValuesList, double xValue, ref int colorIndex) { //double MaxX = AddLineHatchManager.findMaxX(xValuesList); //double MinX = AddLineHatchManager.findMinX(xValuesList); #region /** * double MaxX = lrptstart.XValue+50; * double MinX = lrptstart.XValue; * double length = MaxX-MinX; * * * Color sourceColor = Color.Blue; * Color destColor = Color.Red; * * int redSpace = destColor.R - sourceColor.R; * int greenSpace = destColor.G - sourceColor.G; * int blueSpace = destColor.B - sourceColor.B; * * * double proportion = (xValue-lrptstart.XValue) / length; * * int r = int.Parse(Math.Round(sourceColor.R + proportion * redSpace).ToString()); * int g = int.Parse(Math.Round(sourceColor.G + proportion * greenSpace).ToString()); * int b = int.Parse(Math.Round(sourceColor.B + proportion * blueSpace).ToString()); * * * * * colorIndex = Color.FromArgb(r, g, b).ToArgb(); **/ #endregion #region double MaxX = lrptstart.XValue + 50; double MinX = lrptstart.XValue; double length = MaxX - MinX; double step = (MaxX - MinX) / 3; double ZoneOne = MinX + step; double ZoneTwo = MinX + 2 * step; CurveColorEnum curvecolor = CurveColorEnum.BlackToRed; if (xValue >= MinX && xValue < ZoneOne) //白 -》 黄 { curvecolor = CurveColorEnum.WhiteToYellow; AddLineHatchManager.selectLittleColorByXValue(xValue, ref curvecolor, MinX, ZoneOne, ref colorIndex); } else if (xValue >= ZoneOne && xValue < ZoneTwo) //黄 -》 红 { curvecolor = CurveColorEnum.YellowToRed; AddLineHatchManager.selectLittleColorByXValue(xValue, ref curvecolor, ZoneOne, ZoneTwo, ref colorIndex); } else if (xValue >= ZoneTwo && xValue <= MaxX) //红 -》黑 { curvecolor = CurveColorEnum.RedToBlack; AddLineHatchManager.selectLittleColorByXValue(xValue, ref curvecolor, ZoneTwo, MaxX, ref colorIndex); } else { // curvecolor = CurveColorEnum.RedToBlack; //return; // AddLineHatchManager.selectLittleColorByXValue(xValue, ref curvecolor, ZoneTwo, MaxX, ref colorIndex,true); throw new Exception("???wxcs hatch"); //return; } #endregion }