Пример #1
0
        private void DrawChart(ItemWashing item, Graphics graphics, Pen pen, PictureBox pictureBox, int trackBar)
        {
            //get Bitmap theo độ cao và rộng của PuctureBox
            Bitmap img = new Bitmap(pictureBox.Width, pictureBox.Height, graphics);
            //gán Graphics = img
            Graphics g = Graphics.FromImage(img);

            //giảm độ bớt răng cưa
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            for (int i = 0; i <= 10; i++)
            {
                int iPoint = i * 15;
                g.DrawLine(pen, new Point(iPoint, 0), new Point(iPoint, img.Height));
                g.DrawLine(pen, new Point(0, iPoint), new Point(img.Width, iPoint));
            }
            //Vẻ các đường chéo tạo thành các hình tam giác
            //=
            pen.Brush = Brushes.HotPink;
            g.DrawLine(pen, new Point(0, 0), new Point(15 * 5, 150));
            //=
            pen.Brush = Brushes.LightBlue;
            g.DrawLines(pen, new Point[] { new Point(0, 150), new Point(75, 0), new Point(150, 150) });
            //=
            pen.Brush = Brushes.Khaki;
            g.DrawLine(pen, new Point(150, 0), new Point(15 * 5, 150));
            //=
            //int y;
            if (item.numberSmall != 0)
            {
                //màu của bút
                pen.Brush = Brushes.Bisque;
                DrawLine(pen, g, item.numberSmall, trackBar);
            }
            if (item.numberMedium != 0)
            {
                //màu của bút
                pen.Brush = Brushes.Brown;
                DrawLine(pen, g, item.numberMedium, trackBar);
            }
            if (item.numberLarger != 0)
            {
                pen.Brush = Brushes.DarkOrange;
                DrawLine(pen, g, item.numberLarger, trackBar);
            }
            pictureBox.Image = img;
            g.Dispose();
        }
Пример #2
0
 public WashingInput(ItemWashing item, Graphics graphics, Pen pen, PictureBox pictureBox, int trackBar)
 {
     DrawChart(item, graphics, pen, pictureBox, trackBar);
 }