Print button that will print two datagrids side by side RRS feed

  • Question

  • User-373571878 posted

    Hello,  (I hope this is not a duplicate question, I entered before and never saw it in queue)

    I have a form that has two datagrids side by side, when I use the code below to print the screen, the two datagrids print stacked on each other, not side by side.

    Do you see an adjustment that could fix this?

    Dim W As Integer = System.Math.Max(grdLeft.Width, grdRight.Width)
    Dim h As Integer = grdLeft.Height + grdLeft.Height
    Dim bmp As Bitmap = New Bitmap(W, h)
    Dim r As Rectangle = New Rectangle(0, 0, grdLeft.Width, grdLeft.Height)

    grdLeft.DrawToBitmap(bmp, r)
    r.Y = grdLeft.Height
    r.Width = grdRight.Width
    r.Height = grdRight.Height
    grdRight.DrawToBitmap(bmp, r)
    e.Graphics.DrawImage(bmp, e.MarginBounds)


    Thursday, February 28, 2019 3:34 PM


All replies