printout quality of MSFlexgrid & text box

Inherited a VB5 project, now running on Windows NT4, that used TextBoxes and FlexGrids to generate reports.

The print quality of fields using text box and flexgrid is horrible -- appears like a dot matrix generated field instead of the usual crisp image that a HP LaserJet usually produces.

Originally the project was designed for Win NT3.x that required use of  text box for word wraping. When we upgraded to Win NT4, I changed text box to lables and solved this print quality problem.

FlexGrid is used to sort the data by several criteria (greatest strengths, greatest needs, etc); the FlexGrid does a nice job, but the printed reports look "cheap". Is there an alternative to FlexGrid that produces good print quality reports, or am I missing a setting or some other code?

Thanks in Advance, brian
bubba50Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Erick37Commented:
Make sure that the .Font property is set to a font which is installed on the system, and is a supported size.
0
bubba50Author Commented:
already have on code page:
           grdIndivItemStats.Font = "Arial"
           grdIndivItemStats.Font.Size = 11
(and Arial is a standard font that is installed on this computer; 11 is supported)
0
mcriderCommented:
How is the FlexGrid being printed?  If you are sending the FlexGrid to the printer as an Image, it WILL be grainy.

To solve this problem you will need to format the print yourself by going to each cell and printing it to the printer...


Cheers!
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

mark2150Commented:
Problem is that you're basicially dumping a screen snapshot to the printer instead of rendering the output on the print device. Is subtle but important difference.

The images on the screen are a nominal 72 DPI while the laser is 300/600. If you PrintForm to dump what is on screen to printer you'll either get a very tiny (1/4 or 1/8 size), crisp print or you'll get a larger, blocky image. There's no option to get a crisp, large image.

This is because the fonts are rendered at 72DPI and when printed at 300DPI they either print tiny (1:1) or blocky as the 72 DPI is scaled up to 300DPI. Jacking up the printer resolution in the print dialog doesn't help.

The way out of this requires that you completely TOSS the existing print routine and come at it from a different direction. Instead of rendering to the screen and then using a screen dump, you should render directly to the printer. This will allow the printer to interprit the font commands in the best mode it can and will give you beautiful looking printouts.

You have to treat the printer as a plotter. You set the cursor location with .CurrentX/Y and then print a piece of text with Printer.Print "Some Text". This will give you great results, but is pretty much a pain to code.

You can set the printers .Scale property to Inches instead of twips so that you don't have to be converting dimensions all over the place.

You can also then use the .Line and .Circle methods to draw objects on the page. This allows you to exactly duplicate forms that look great no matter what the printer resolution.

Anyway, this is the way to do it.

You'll find that the grid doesn't have a .Print method and you'll be unable to print it with a single command. Rather you'll have to set up a loop and print you data direct from the recordset.

Say I want three columns, one at the left, one at 3" and a third at 6". This is how I'd have to code:

Const Col1 as Double = 0.0
Const Col2 as Double = 3.0
Const Col3 as Double = 6.0
Const BottomMargin as Double = 10.0
Const TopMargin as Double = 1.0
Spacing = 1/6 '6LPI in inches
'
Printer.Scale (0, 0)-(8, 10.5)  '8-1/2x11 w/ 1/4" margins
Printer.CurrentY = TopMargin  'Start at top of page
'
' Put heading print commands here...
'
' Iterate thru recordset printing as you go...
'
DO WHILE NOT RS.EOF
  If Printer.CurrentY > BottomMargin Then
    Printer.NewPage
    Printer.CurrentY = TopMargin
  End If
  '
  OldY = Printer.CurrentY
  Printer.CurrentX = Col1
  Printer.Print "" & RS!Field1  'Print column 1
  Printer.CurrentY = OldY
  Printer.CurrentX = Col2
  Printer.Print "" & RS!Field2  'Print column 2
  Printer.CurrentY = OldY
  Printer.CurrentX = Col3
  Printer.Print "" & RS!Field3  'Print column 3
  Printer.CurrentY = OldY + Spacing
  '
  RS.MoveNext
Loop
'
Printer.EndDoc

You can also determine the width of the text about to be printed by using the .TextWidth property. This allows you to center or right justify by sticking the text in a var and then adjusting the .CurrentX of the text by subtracting either half the .TextWidth to center of all of the .TextWidth to right align.

This is a bit of a pain to code, but the results are well worth it.

M
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Éric MoreauSenior .Net ConsultantCommented:
There are 3-party grid products our there that have a Print method that does its job very well. I often use Sheridan DataWidgets.

You can download a trial from www.shersoft.com
0
vbyuvalCommented:
       
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.