Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing a Gride 1

Status
Not open for further replies.

Stainnd

Programmer
Jul 9, 2001
65
US
I'm writing a program that basically works with databases. The one problem i have that is bothering me the most is this. The people for whom I am writing the program asked for the optoin to print the different tables that they're working with. In other words, I need to be able to print a table, or a datagrid/flexgrid control. Can anyone help me out?
 
I need to know how to do it also. someone said to copy it to a picturebox then print the picture, but i havent had time to try it.
 
how would u copy it to a picturebox? i thought of that too, but i wasn't sure how to do it
 
One of the main problems that I've found is quality of print. Now, I wasn't using a grid - I was using a Listview in Report mode, but when printed the text was very jagged.

In fact, the only control which prints well appears to be the label control. With that in mind, I wrote a control (basically a 2D grid of label controls) and transferred the Listview to this new control prior to printing.

Now, it does work - prints look great. But the control is a pain to use, appears to be buggy (or at least, hit some VB bugs) and I'm too embarassed to share it with you.

Hopefully though, I've given you some clues as to a possible direction.

Chaz
 
When you print, do you use the print form command? Because if you use that, then whether you use the datagrid or the label idea, my problem still stands that if the datagrid is really big, even if I maximized the window, it still wouldn't be enough room to print the entire datagrid. My real problem is that if i want to print a grid that is either bigger than the form horizontally or vertically, print form only prints the form, and I don't know any other way. So really what i'm saying is how do i print it other than print form.
 
I got it to print the whole grid, but when i do it colors in the background. I need something like being able to make the grid background transperant or something. I tried changing the back color to like white, but it still prints in gray...oh well, here's what i did to print the whole thing...add a picturebox and make it hidden

Private Sub cmdPrint_Click()

Clipboard.SetData MSHFlexGrid1.Picture, 2
Picture1.Picture = Clipboard.GetData
Printer.PaintPicture Picture1.Picture, 10, 10
DoEvents
Printer.EndDoc

End Sub

PS anyone know how to print just the cell contents without a colored background???
Dragnut
 
i've gotta try this out, but if it works...i love you. i really do. :) Uh...anyway, thanks a lot.
-Mike
 
It works well. The only problem is... I need the flexgrid to have certain set widths for each column, and then to auto-set the row height so that all the data fits in each cell w/o the user having to re-size everything by hand. Thanks
-Mike
 
I haven't got that far playing with the grids :) Glad the printing part worked for you.
Dragnut
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top