Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I really enjoy your site. You have a lot of helpful and friendly experts who contribute so willingly. Thank you for past (and future) technical advice..."

Geography

Where in the world do Tek-Tips members come from?
zwq (Programmer)
2 Aug 10 8:03
I have a problem with the Print() and PrintDialog().
I have a form with a vertical ScrollBar.

...
if(PrintDialog1->Execute())
            {
             File1->Visible=False;
                         Form20->VertScrollBar->Position=0;
             Form20->Print;
             File1->Visible=True;
            }
...

This code print me only the visible part of form (700/1000 pixel).How can I print all the form without changing the height of the form?
Thank you.
 
2ffat (Programmer)
2 Aug 10 14:24
I've not used the print dialog in a long time but it you might want to set the FromPage, ToPage, and PrintRange. The following code is from the BCB6 help file:

CODE

void __fastcall TForm1::Button1Click(TObject *Sender)

{
  PrintDialog1->Options.Clear();
  PrintDialog1->Options << poPageNums << poSelection;
  PrintDialog1->FromPage = 1;
  PrintDialog1->MinPage = 1;
  PrintDialog1->ToPage = PageControl1->PageCount;
  PrintDialog1->MaxPage = PageControl1->PageCount;
  if (PrintDialog1->Execute())
  {
    int Start, Stop;
    // determine the range the user wants to print
    switch (PrintDialog1->PrintRange)
    {
      case prSelection:

        Start = PageControl1->ActivePage->PageIndex;
        Stop = Start;
        break;
      case prPageNums:
        Start = PrintDialog1->FromPage - 1;
        Stop =  PrintDialog1->ToPage - 1;
        break;
      default:  // prAllPages
        Start = PrintDialog1->MinPage - 1;
        Stop = PrintDialog1->MaxPage - 1;
        break;
    }
    // now, print the pages
    Printer()->BeginDoc();
    for (int i = Start; i <= Stop; i++)

    {
      PageControl1->Pages[i]->PaintTo(Printer()->Handle, 10, 10);
      if (i != Stop)
        Printer()->NewPage();
    }
    Printer()->EndDoc();
  }
}
 

James P. Cottingham
I'm number 1,229!
I'm number 1,229!

zwq (Programmer)
2 Aug 10 14:31
thank you very much for the replay.
That code i think is for more then one pages.
For anyone who has this problem I found a tricky solve:D

if(PrintDialog1->Execute())
            {
             File1->Visible=False;
             Form20->VertScrollBar->Position=0;
             Form20->AutoScroll=false;
             Form20->BorderStyle=bsNone;
             Form20->Height=1000;
             Form20->Width=805;
             Form20->Print();
             Form20->Height=700;
             Form20->Width=805;
             Form20->BorderStyle=bsSizeable;
             Form20->AutoScroll=true;
             File1->Visible=True;
            }

What's the trick: Form20->BorderStyle=bsSizeable; (by default) dosen't let you set a hight larger then resolution (for example: if you set the resolution 1152x864,you can set to form a maxim height 864).But if BorderStyle=bsNone you can set what height you want.And this little trick isn't so visible in application:) Thank you for your support.
  

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close