using System; using System.Drawing; namespace ClassLibrary { public class GradationCurve { static int _trekW = 25; // 10 - 50 //double _arc = 10; static int[] _profileColor; public int[] ProfileColor { get { return _profileColor; } set { _profileColor = value; } } GradationCurve() { _profileColor = new int[256] {66, 71, 76, 81, 85, 90, 94, 98, 102, 106, 110, 114, 118, 121, 124, 128, 131, 134, 137, 140, 142, 145, 148, 150, 153, 155, 157, 159, 161, 164, 166, 167, 169, 171, 173, 175, 176, 178, 180, 181, 183, 184, 186, 187, 189, 190, 191, 193, 194, 195, 197, 198, 199, 200, 201, 203, 204, 205, 206, 207, 208, 209, 210, 211, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 228, 229, 230, 230, 231, 232, 233, 234, 235, 236, 237, 238, 238, 239, 240, 241, 241, 242, 243, 244, 244, 245, 246, 246, 247, 248, 248, 249, 249, 250, 250, 251, 251, 252, 252, 252, 253, 253, 253, 254, 254, 254, 254, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 254, 254, 254, 254, 253, 253, 253, 252, 252, 252, 251, 251, 250, 250, 249, 249, 248, 248, 247, 246, 246, 245, 244, 244, 243, 242, 241, 241, 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, 230, 230, 230, 229, 228, 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, 216, 215, 214, 213, 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, 200, 199, 198, 197, 195, 194, 193, 191, 190, 189, 187, 186, 184, 183, 181, 180, 178, 176, 175, 173, 171, 169, 167, 166, 164, 161, 159, 157, 155, 153, 150, 148, 145, 142, 140, 137, 134, 131, 128, 124, 121, 118, 114, 110, 106, 102, 98, 94, 90}; } public static void DrawGradationArc(float x, float y, float Width, float Height, float StAngle, float WAngle, Graphics grBack, int[] profileColor, int trekW) { int RGB; Pen pn; Color col; float ncol; _profileColor = profileColor; _trekW = trekW; RectangleF Rect = new RectangleF(x - Width / 2, y - Height / 2, Width, Height); for (float i = 0; i < _trekW; i += 0.2F) { ncol = 254 * i / (float)_trekW; RGB = _profileColor[Convert.ToInt32(ncol)]; col = Color.FromArgb(255, RGB, RGB, RGB); //Brush br = Color.FromArgb(255, RGB, RGB, RGB); //Brush br = new Brushes.White; //SolidBrush(Color.Black); pn = new Pen(col, 1); Rect.Width = Width + 2 * i; Rect.Height = (Width + 2 * i); // / ((float)_arc / 10); Rect.X = x - Width / 2 - i; Rect.Y = y - Height / 2 - i; // / (float)(_arc / 10) ; /*Rect.X = x - i; Rect.Y = y - i; Rect.Width = Width + 2 * i; Rect.Height = Height + 2 * i;*/ grBack.DrawArc(pn, Rect, StAngle, WAngle); pn.Dispose(); } } public static void DrawGradationArc(float x, float y, float Width, float Height, float StAngle, float WAngle, Graphics grBack, int[] profileColor) { int RGB; Pen pn; Color col; float ncol; //_profileColor = profileColor; //_trekW = trekW; RectangleF Rect = new RectangleF(x - Width / 2, y - Height / 2, Width, Height); _profileColor = profileColor; for (float i = 0; i < _trekW; i += 0.2F) { ncol = 254 * i / (float)_trekW; RGB = _profileColor[Convert.ToInt32(ncol)]; col = Color.FromArgb(255, RGB, RGB, RGB); //Brush br = Color.FromArgb(255, RGB, RGB, RGB); //Brush br = new Brushes.White; //SolidBrush(Color.Black); pn = new Pen(col, 1); Rect.Width = Width + 2 * i; Rect.Height = (Width + 2 * i); // / ((float)_arc / 10); Rect.X = x - Width / 2 - i; Rect.Y = y - Height / 2 - i; // / (float)(_arc / 10) ; /*Rect.X = x - i; Rect.Y = y - i; Rect.Width = Width + 2 * i; Rect.Height = Height + 2 * i;*/ grBack.DrawArc(pn, Rect, StAngle, WAngle); pn.Dispose(); } } } }