How to print the content of the form such as flexigrid only or frame only?

How to print the content of the form such as flexigrid only or frame only?

I've been trying how solve my problem. I have developed a school system (schedule for school/teacher/student), I'm already there, but stuck in printing the schedule.

What I want is to print (to the printer) the schedule that I developed using flexigrid include the grid and color (like print screen) but this time is only flexigrid...

Who is Participating?
mcriderConnect With a Mentor Commented:
Check out this Microsoft KB article...

HOWTO: Capture and Print the Screen, a Form, or any Window

You can use the routines here to capture the grid and print it...

Warning, it is kinda complicated code...

Printer.PaintPicture MSFlexGrid1.Picture, 0, 0
Printer.PaintPicure will work as suggested by Erick37 but if you don't have enough memory to print in color mode, change the MSFlexGrid to mono mode before send it to the Printer Object.  If you need color you have to have lots of memory.

I have 128MB on my machine and it still won't print color MSFlexGrid (at least in the IDE mode, haven't tried in the compiled exe version)
The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

saltacidAuthor Commented:
Thank you so much,
I need further explanation .... if my flexigrid contains multi-colors, do I have to code it or it will automatically recognized the color when I use Printer.PaintPicture ?

since I haven't been able to print color MSFlexGrid myself (and b/w will do for my project), I cannot give you a definite answer.

However, I am 80% sure that the Printer object prints what you send to it without modifiying it, so it should print a color image.

I am guessing may be the part that you don't understand is the MSFlexGrid's picture.  It is like a screen capture except it captures exactly what you see for the MSFlexGrid only.  

NOTE:  it does not print what you can't see.

Why don't you try to print a small color sample grid and see how it works?
saltacidAuthor Commented:
I have tried printing the content of MSFlexigrid...but currently I did manage to print on normal laser printer.

On my MSFlexigrid, I put several colors in order to differentiate
the dark and bright when I print on the normal printer(non color printer), and it worked.

Eventhough it's black and white, but the brightness and darkness of the color show the differences.

(reply to leesss)
And you say "it does not print what you can't see" is not true if you mean if there is scrolls exist. (probably you mean something else"

I have created MSFlexigrid with two scroll bars (vert. and hor.)
and it printed all the contents of the MSFlexigrid without scroll bars printed.

eg. If I create 5 columns and 5 rows, and the size of the MSFlexigrid is only shows 1 row and 2 columns, but when I use
command :-
      Printer.PaintPicture MSFlexgrid1.Picture,0,0

     It will print the whole 5 columns and 5 rows perfectly.

Good for you.  So everything is resolved?

Good point about the scroll bars.  Mine didn't have them, but I didn't need them so I never tried them.  If your column width is smaller than your text so that not all your text is visible, and you use the picture to print, you won't see the text.
All Courses

From novice to tech pro — start learning today.