DrawtoBitmap is not working correctly

Originally Posted 1 June 2017, 5:00 am EST

  • Originally Posted 1 June 2017, 5:00 am EST

    Hi Guys,

    I have a groupbox with c1textbox and c1numericEdit, I want to draw this groupbox into bitmap. But in the bitmap I see only white rectangles of these controls (there are no borders and buttons with arrows).
    Please look at the attached example.

    p.s. With VS controls - no problems.
    2017/06/WindowsFormsApplication7.rar
  • Reply

    Hello,

    Thank you for sharing the sample application.

    I could observe the issue at my end and hence have escalated it {Tracking ID:263457} to the concerned team. I will update once it is fixed.

    Thanks,
    Ruchir Agarwal
  • Marked as Answer

    Reply

    Hi,
    For the meantime, you can use below code snippet to achieve your requirement:


    Bitmap BMP = new Bitmap(Screen.PrimaryScreen.Bounds.Width,
    Screen.PrimaryScreen.Bounds.Height,
    PixelFormat.Format32bppArgb);
    using (Graphics GFX = Graphics.FromImage(BMP))
    {
    GFX.CopyFromScreen(Screen.PrimaryScreen.Bounds.X,
    Screen.PrimaryScreen.Bounds.Y,
    0, 0,
    Screen.PrimaryScreen.Bounds.Size,
    CopyPixelOperation.SourceCopy);
    }
    Bitmap YourImage = new Bitmap(groupBox2.Width, groupBox2.Height);
    using (Graphics g = Graphics.FromImage(YourImage))
    {
    Point np = groupBox2.PointToScreen(new Point(0, 0));
    g.DrawImage(BMP, new Rectangle(0, 0, groupBox2.Width, groupBox2.Height), new Rectangle(np, groupBox2.Size), GraphicsUnit.Pixel);
    }

    pictureBox2.Image = YourImage;



    Hope, it will work.

    Thanks,
    Sonu
  • Reply

    Hello!

    The issue can be found fixed in 2018-V1 builds. You can upgrade to 4.0.20181.296 via C1Live.

    Best regards,
    Meenakshi
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels