CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 1999
    Location
    MD, USA
    Posts
    34

    Flexgrid Printing

    Any suggestion on how I can print the contents of a flexgrid ?
    Right now when I print it, it is printing the form and not the whole of the grid is printed out.

    Thanks !


  2. #2
    Join Date
    Sep 1999
    Location
    Red Wing, MN USA
    Posts
    312

    Re: Flexgrid Printing

    If you want a Graphical representation of ALL Rows/Columns in the Grid, then use the FlexGrids Picture Property, ie.
    Printer.PaintPicture MSFlexGrid1.Picture, 0, 0
    Printer.EndDoc


    Otherwise you'll need to Traverse the contents of the Grid yourself Sending each Cell/Row to the Printer One at a Time.

    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]
    Certified AllExperts Expert: http://www.allexperts.com/displayExp...p?Expert=11884
    Aaron Young
    Senior Programmer Analyst (Red Wing Software)
    Certified AllExperts Expert

  3. #3
    Join Date
    Dec 1999
    Location
    MD, USA
    Posts
    34

    Re: Flexgrid Printing

    Can you set the page margins ?
    Also, the Grid is too big to fit in one page.
    Is there any way I can make it fit in a page or have it print the rest in the next page?


  4. #4
    Join Date
    Sep 1999
    Location
    Red Wing, MN USA
    Posts
    312

    Re: Flexgrid Printing

    You could certainly rescale the Image to fit the Page, ie.
    private Sub Command1_Click()
    Dim W as Single
    Dim H as Single

    With Printer
    W = ScaleX(MSFlexGrid1.Picture.Width, vbHimetric, .ScaleMode)
    H = ScaleY(MSFlexGrid1.Picture.Height, vbHimetric, .ScaleMode)
    If W > .ScaleWidth Or H > .ScaleHeight then
    'Make the Image Fit the Printed Page..
    .PaintPicture MSFlexGrid1.Picture, 0, 0, IIf(W > .ScaleWidth, .ScaleWidth, W), IIf(H > .ScaleHeight, .ScaleHeight, H), 0, 0, W, H
    else
    .PaintPicture MSFlexGrid1.Picture, 0, 0
    End If
    .EndDoc
    End With
    End Sub



    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]
    Certified AllExperts Expert: http://www.allexperts.com/displayExp...p?Expert=11884
    Aaron Young
    Senior Programmer Analyst (Red Wing Software)
    Certified AllExperts Expert

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured