//рисование кругов private void PalitreDrawEilerCircls() { Palitre palitreBuffer = new Palitre(); GraphicsPath gp = new GraphicsPath(); PointF[] pts = { new PointF(130, 130), new PointF(135, 135) }; gp.AddArc(170 - 130, (180 - 130), 260, 260, -40, 80); gp.AddArc(370 - 130, (180 - 130), 260, 260, 140, 80); Bitmap bmp = new Bitmap(540, 360); Graphics drawIt = Graphics.FromImage(bmp); palitreBuffer.BackColor = Color.FromArgb(255, int.Parse(textBoxPalitreColorsBGR.Text.ToString()), int.Parse(textBoxPalitreColorsBGG.Text.ToString()), int.Parse(textBoxPalitreColorsBGB.Text.ToString())); palitreBuffer.Blue = Color.FromArgb(255, int.Parse(textBoxPalitreColorsBlueR.Text.ToString()), int.Parse(textBoxPalitreColorsBlueG.Text.ToString()), int.Parse(textBoxPalitreColorsBlueB.Text.ToString())); palitreBuffer.Red = Color.FromArgb(255, int.Parse(textBoxPalitreColorsRedR.Text.ToString()), int.Parse(textBoxPalitreColorsRedG.Text.ToString()), int.Parse(textBoxPalitreColorsRedB.Text.ToString())); drawIt.Clear(palitreBuffer.BackColor); drawIt.FillEllipse((new Pen(palitreBuffer.Blue)).Brush, 170 - 130, (180 - 130), 260, 260); drawIt.FillEllipse((new Pen(palitreBuffer.Red)).Brush, 370 - 130, (180 - 130), 260, 260); drawIt.FillPath(MashedColor(palitreBuffer), gp); pictureBoxPalitre.Image = bmp; if (saved == false) PalitreActivateSaving(); }
//загрузка палитры пациента private void PalitreShowInfo(Palitre palitre) { textBoxPalitreColorsRedR.Text = (Color.FromArgb(palitre.iRed)).R.ToString(); textBoxPalitreColorsRedG.Text = (Color.FromArgb(palitre.iRed)).G.ToString(); textBoxPalitreColorsRedB.Text = (Color.FromArgb(palitre.iRed)).B.ToString(); textBoxPalitreColorsBlueR.Text = (Color.FromArgb(palitre.iBlue)).R.ToString(); textBoxPalitreColorsBlueG.Text = (Color.FromArgb(palitre.iBlue)).G.ToString(); textBoxPalitreColorsBlueB.Text = (Color.FromArgb(palitre.iBlue)).B.ToString(); textBoxPalitreColorsBGR.Text = (Color.FromArgb(palitre.iBG)).R.ToString(); textBoxPalitreColorsBGG.Text = (Color.FromArgb(palitre.iBG)).G.ToString(); textBoxPalitreColorsBGB.Text = (Color.FromArgb(palitre.iBG)).B.ToString(); saved = true; PalitreDrawEilerCircls(); }
//цвет пересечения private Brush MashedColor(Palitre palitreBuffer) { int R = 0, G = 0, B = 0; if ((palitreBuffer.Red.R + palitreBuffer.Blue.R) > 255) R = 255; else R = palitreBuffer.Red.R + palitreBuffer.Blue.R; if ((palitreBuffer.Red.G + palitreBuffer.Blue.G) > 255) G = 255; else G = palitreBuffer.Red.G + palitreBuffer.Blue.G; if ((palitreBuffer.Red.B + palitreBuffer.Blue.B) > 255) B = 255; else B = palitreBuffer.Red.B + palitreBuffer.Blue.B; return (new Pen(Color.FromArgb(R, G, B))).Brush; }