| |

VerySource

 Forgot password?
 Register
Search
View: 2348|Reply: 11

After printing A4 and B5, the size of the output waveform does not change.

[Copy link]

1

Threads

8

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-1-26 17:00:01
| Show all posts |Read mode
I put the waveform on PaintBox, how can I make the printed waveform size unchanged when A4 and B5 change? The following program changes the waveform size after A4 and B5 are changed.
void PrintImage (TPaintBox * SRE)
{
   Printer ()-> Canvas-> StretchDraw (
      Rect (SRE-> Left * Printer ()-> PageWidth / Panel1-> Width,
           SRE-> Top * Printer ()-> PageHeight / Panel1-> Height,
           (SRE-> Left + SRE-> Width) * Printer ()-> PageWidth / Panel1-> Width,
           (SRE-> Top + SRE-> Height) * Printer ()-> PageHeight / Panel1-> Height),
      SRE-> Picture-> Graphic);
}
PaintBox is placed on Panel1.
How do I change to meet the above requirements?
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-2-21 13:00:01
| Show all posts
Calculating a fixed ratio using B5 paper should be fine
Do not use Printer ()-> PageHeight directly

BTW:
Printer using StretchDraw may fail
Reply

Use magic Report

1

Threads

8

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-7-23 22:00:01
| Show all posts
Reply

Use magic Report

1

Threads

8

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-7-23 22:15:01
| Show all posts
Are there any experts who comment?
Reply

Use magic Report

1

Threads

8

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-8-11 12:30:01
| Show all posts
Worry, no one asked
The printer may fail to use StretchDraw, so how can I change it?
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-8-11 23:30:01
| Show all posts
void Print_Bitmap(TCanvas *lpCanvas, TRect rectDest, Graphics::TBitmap *lpBitmap)
{
    DIBSECTION DibSec;
    GetObject(lpBitmap->Handle, sizeof(DibSec),&DibSec);

    StretchDIBits(lpCanvas->Handle,
        rectDest.Left, rectDest.Top,
        (rectDest.Right-rectDest.Left), (rectDest.Bottom-rectDest.Top),
        0, 0,
        lpBitmap->Width, lpBitmap->Height,
        DibSec.dsBm.bmBits,
        (BITMAPINFO*)&DibSec.dsBmih,
        DIB_RGB_COLORS,
        SRCCOPY);
}
Reply

Use magic Report

1

Threads

8

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

 Author| Post time: 2020-8-12 13:45:01
| Show all posts
starburg: How to use this, can you elaborate on it?
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-8-12 19:00:02
| Show all posts
Proportional problem
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-12 19:15:02
| Show all posts
If you want to ensure that the absolute size printed on the paper is unchanged, you need to obtain the printer's
The output resolution is good, and it can generally be calculated like this:
(1)Printer()->PageHeight
            ->PageWidth
   Get the length and width points of the page size, Canvas press this unit
(2)DPIx=GetDeviceCaps(Printer()->Handle,LOGPIXELSX)
   DPIy=GetDeviceCaps(Printer()->Handle,LOGPIXELSY)
   Get the current printer's print resolution, note: X and Y directions may be different, unit: dots/inch
(3) Scale your output graphics according to the resolution and the print size you need

For example: the printer resolution is 600 dpi (X, Y directions are the same)
      Page 10*8 inch
For the program, the Canvas size of the printer page will be: 6000*4800

The specific calculation is not too complicated
Might as well try
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-8-12 19:45:01
| Show all posts
What does the original poster do not understand?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list