RobotStudio event

Trouble with displaying the picturebox on real flexpendant

Hi,

I have a problem with displaying the picturebox on real flexpendant. On the virtual controller the picture is displayed without any problems (see MainScreen.png) . And that's what happens in reality (real.jpg). I have nothing idea how to fix it. I use picturebox from flexpendant toolbox.

Here's my code:

 private void disk()
        {
            pictureBox1.Image = new Bitmap(pictureBox1.Width, pictureBox1.Height);
            using (Graphics g = Graphics.FromImage(pictureBox1.Image))
            {
                g.DrawEllipse(new Pen(Color.Black, 4), 0, 0, 277, 277);
                g.FillEllipse(new SolidBrush(Color.AliceBlue), 0, 0, 277, 277);
                g.DrawEllipse(new Pen(Color.Black, 4), (277 - 47) / 2, (277 - 47) / 2, 47, 47);
                g.FillEllipse(new SolidBrush(Color.White), (277 - 47) / 2, (277 - 47) / 2, 47, 47);
            }
            pictureBox1.Refresh();
        }

private void rectangle()
        {
            for (int i = 1; i < k; i++)
            {
                for (int j = 1; j < m; j++)
                {
                    //some logic here

                    if (l1 < D / 2 && l2 < D / 2 && l3 < D / 2 && l4 < D / 2 && l1 > d / 2 && l2 > d / 2 && l3 > d / 2 && l4 > d / 2)
                    {
                        using (Graphics g = Graphics.FromImage(pictureBox1.Image))
                        {
                            RectangleF myRectangleF = new RectangleF(x1 , y1 , b, h);
                            Rectangle truncatedRectangle = Rectangle.Truncate(myRectangleF);
                            g.DrawRectangle(new Pen(Color.DodgerBlue), truncatedRectangle);
                            SolidBrush Brush = new SolidBrush(Color.DodgerBlue);
                            g.FillRectangle(Brush, truncatedRectangle);
                        }
                    }
                    pictureBox1.Refresh();
                }
            }
        }

Best Answer

  • egor
    egor
    Answer ✓
    Solve my problem using picturebox from the standart windows toolbox.