private void UpdateChart() { label_doban.Text = "Độ bẩn : " + trackBar_doban.Value.ToString(); label_loaichatban.Text = "Loại chất bẩn : " + trackBar_loaichatban.Value.ToString(); cloudiness = new Cloudiness(trackBar_doban.Value); kindOfDir = new KindOfDirt(trackBar_loaichatban.Value); washing = new Washing(); label_washingtime.Text = "Thời gian giặt : " + washing.ComputeTime(cloudiness, kindOfDir).ToString(); isGiatNgam(); this.Invalidate(); }
private void GraphicChar(Graphics g, Pen pen, Washing washing, CheckBox checkBox_Fill) { //Graph pen.Brush = Brushes.PowderBlue; if (washing._VeryShort != 0.0f) { float y = 150 - washing._VeryShort * 150; float x1 = 0; float x2 = (3 - washing._VeryShort) * 10; if (checkBox_Fill.Checked == true) { PointF[] p = { new PointF(x1, y), new PointF(x2, y), new PointF(30, 150), new PointF(0, 150) }; g.FillPolygon(Brushes.White, p); } else { g.DrawLine(pen, x1, y, x2, y); } } if (washing._Short != 0.0f) { float y = 150 - washing._Short * 150; float x1 = (4 * washing._Short + 8) * 2.5f; float x2 = (20 - 8 * washing._Short) * 2.5f; if (checkBox_Fill.Checked == true) { PointF[] p = { new PointF(x1, y), new PointF(x2, y), new PointF(50, 150), new PointF(20, 150) }; g.FillPolygon(Brushes.White, p); } else { g.DrawLine(pen, x1, y, x2, y); } } if (washing._Medium != 0.0f) { float y = 150 - washing._Medium * 150; float x1 = (8 * washing._Medium + 12) * 2.5f; float x2 = (40 - 20 * washing._Medium) * 2.5f; if (checkBox_Fill.Checked == true) { PointF[] p = { new PointF(x1, y), new PointF(x2, y), new PointF(100, 150), new PointF(30, 150) }; g.FillPolygon(Brushes.White, p); } else { g.DrawLine(pen, x1, y, x2, y); } } if (washing._Long != 0.0f) { float y = 150 - washing._Long * 150; float x1 = (20 * washing._Long + 20) * 2.5f; float x2 = (60 - 20 * washing._Long) * 2.5f; if (checkBox_Fill.Checked == true) { PointF[] p = { new PointF(x1, y), new PointF(x2, y), new PointF(150, 150), new PointF(50, 150) }; g.FillPolygon(Brushes.White, p); } else { g.DrawLine(pen, x1, y, x2, y); } } if (washing._VeryLong != 0.0f) { float y = 150 - washing._VeryLong * 150; float x1 = (20 * washing._VeryLong + 40) * 2.5f; float x2 = 150; if (checkBox_Fill.Checked == true) { PointF[] p = { new PointF(x1, y), new PointF(x2, y), new PointF(150, 150), new PointF(100, 150) }; g.FillPolygon(Brushes.White, p); } else { g.DrawLine(pen, x1, y, x2, y); } } g.Dispose(); }
public WashingOutput(Graphics g, Pen pen, Bitmap img, PictureBox pic, Washing washing, CheckBox checkBox_Fill) { DrawPictureBox(g, pen, img, pic); GraphicChar(g, pen, washing, checkBox_Fill); }