Print Preview: Bitmap and Stretchdraw

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

Print Preview: Bitmap and Stretchdraw

Postby markbolten » August 10th, 2009, 7:40 am

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 );
Attachments
test1.pdf
Screenshot as Example
(69.54 KiB) Downloaded 118 times
markbolten
Active Member
Active Member
 
Posts: 8
Joined: February 17th, 2009, 2:11 pm

Re: Print Preview: Bitmap and Stretchdraw

Postby Kambiz » August 10th, 2009, 9:20 am

Could you please attach the complete source code?
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: Print Preview: Bitmap and Stretchdraw

Postby markbolten » August 10th, 2009, 2:36 pm

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
Attachments
code.zip
Sourcecode
(125.91 KiB) Downloaded 126 times
markbolten
Active Member
Active Member
 
Posts: 8
Joined: February 17th, 2009, 2:11 pm

Re: Print Preview: Bitmap and Stretchdraw

Postby Kambiz » August 10th, 2009, 3:19 pm

Needs more work in this way. :)

I just wanted a sample program to be able to trace the code right today.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: Print Preview: Bitmap and Stretchdraw

Postby markbolten » August 11th, 2009, 1:32 pm

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.
Attachments
Sample.zip
Source
(663.31 KiB) Downloaded 107 times
markbolten
Active Member
Active Member
 
Posts: 8
Joined: February 17th, 2009, 2:11 pm

Re: Print Preview: Bitmap and Stretchdraw

Postby markbolten » August 12th, 2009, 7:58 am

Oh, i have attached the wrong file. Here is the correct file
Attachments
Sample 2.zip
correct Sample
(534.5 KiB) Downloaded 142 times
markbolten
Active Member
Active Member
 
Posts: 8
Joined: February 17th, 2009, 2:11 pm

Re: Print Preview: Bitmap and Stretchdraw

Postby Kambiz » August 15th, 2009, 3:00 am

Your code works fine on my computer (Delphi 7 on Vista). :?
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: Print Preview: Bitmap and Stretchdraw

Postby markbolten » August 16th, 2009, 9:25 am

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 :|
Attachments
Sample 3.zip
Sample and 2 Screenshots
(691.46 KiB) Downloaded 156 times
markbolten
Active Member
Active Member
 
Posts: 8
Joined: February 17th, 2009, 2:11 pm


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 2 guests

cron