Page 1 of 1

Print Preview: Bitmap and Stretchdraw

PostPosted: August 10th, 2009, 7:40 am
by markbolten
hello,
i use PrintPreview 5.14, Delphi 7 and Windows XP.

In my Program the Datas/Text will be printing as follow:
At any pageline is an image, a graphical line and then the text.
All is correct until line 27, after this line no image appears. Why that?


Code: Select all
 
        y := r.Top ;
        r.Bottom := r.Bottom - canvas.TextHeight('X');
        groesse := ConvertX(256,mmhimetrics   ,units ); // 2
        line := 1;
        repeat
          line := line+1;
              Canvas.Pen.Mode := pmcopy;
              Canvas.Pen.Width := 0;
              Canvas.Pen.Style := psSolid;
              Canvas.Pen.Color := clBlack;
              canvas.CopyMode := cmSrcCopy;
              bitmaprect.Left := r.Left +((canvas.TextWidth('X')-groesse) div 2);
              bitmaprect.Right := bitmaprect.Left+groesse;
              bitmaprect.Top := y+((canvas.TextHeight('X')-groesse) div 2);
              bitmaprect.Bottom := bitmaprect.Top+groesse;
              if (line mod 2 = 0) then      // expand
              begin
                canvas.StretchDraw(bitmaprect,BitBtn1.glyph);
              end
              else
              begin
//                canvas.Draw(bitmaprect.Left ,bitmaprect.Top ,ButtonzuEin.glyph);
                canvas.StretchDraw(bitmaprect,bitbtn2.glyph );
                  Canvas.MoveTo(bitmaprect.left+(groesse div 2), bitmaprect.
                   Bottom);
                  Canvas.LineTo(bitmaprect.left+(groesse div 2), Y+canvas.
                   TextHeight('X'));
              end;
              Canvas.MoveTo(bitmaprect.Right, y+(canvas.TextHeight('X') div 2));
              Canvas.LineTo(bitmaprect.Right+canvas.TextWidth('X'), Y+
               (canvas.TextHeight('X') div 2));
              canvas.TextOut(r.Left+canvas.TextWidth('XXX'),y,inttostr(line)+
               ' y='+inttostr(y));
           y := y+Canvas.TextHeight('X');
        until (y > r.Bottom );

Re: Print Preview: Bitmap and Stretchdraw

PostPosted: August 10th, 2009, 9:20 am
by Kambiz
Could you please attach the complete source code?

Re: Print Preview: Bitmap and Stretchdraw

PostPosted: August 10th, 2009, 2:36 pm
by markbolten
hello,

Kambiz wrote:Could you please attach the complete source code?


to see the forms (dfm files) you need the toolbar2000 and tbx components

cu
mark

Re: Print Preview: Bitmap and Stretchdraw

PostPosted: August 10th, 2009, 3:19 pm
by Kambiz
Needs more work in this way. :)

I just wanted a sample program to be able to trace the code right today.

Re: Print Preview: Bitmap and Stretchdraw

PostPosted: August 11th, 2009, 1:32 pm
by markbolten
Kambiz wrote:Needs more work in this way. :)

I just wanted a sample program to be able to trace the code right today.


sorry, now you get it.

Re: Print Preview: Bitmap and Stretchdraw

PostPosted: August 12th, 2009, 7:58 am
by markbolten
Oh, i have attached the wrong file. Here is the correct file

Re: Print Preview: Bitmap and Stretchdraw

PostPosted: August 15th, 2009, 3:00 am
by Kambiz
Your code works fine on my computer (Delphi 7 on Vista). :?

Re: Print Preview: Bitmap and Stretchdraw

PostPosted: August 16th, 2009, 9:25 am
by markbolten
Kambiz wrote:Your code works fine on my computer (Delphi 7 on Vista). :?


Good to hear this, than it is something wrong on my computer :cry:

I just find an another Diplay Bug.
if i change in the printersetupdialog (in the mainform) the papertyp from A4 to A5 and the orientation from portrait to llndscape , in the Previewform the Statusbar tells me A4 rotatet and portrait (Screenshot 1 with sample source )


or

Screenshot 2: In my Project the text will shown unformatet, the bottom margin will be ignorr :|