trichview.com

trichview.support




Re: Fit meatfile to page (reposted with subject line)


Return to index


Author

Message

Benedikt Weber

Posted: 06/04/2002 19:07:56


Thanks! This is really first class support!


Benedikt


"Sergey Tkachenko" <[email protected]> wrote in message

news:[email protected]...

> > Thanks alot. The only problem now is that I am using C++. I tried to

just

> > make a Pascal file and include it in my project. However there are some

> > things missing like unit and interface.

> >

> void GetScreenPageSize(TRVPrint* RVPrint,

>                        int& Width, int& Height)

> {

>   HDC DC = RV_GetPrinterDC; // from PtblRV unit

>

>   Width  = GetDeviceCaps(DC, HORZRES);

>   Height = GetDeviceCaps(DC, VERTRES);

>

>   int lpy = GetDeviceCaps(DC, LOGPIXELSY);

>   int lpx = GetDeviceCaps(DC, LOGPIXELSX);

>

>   int phoX = GetDeviceCaps(DC, PHYSICALOFFSETX);

>   int phoY = GetDeviceCaps(DC, PHYSICALOFFSETY);

>   int phW  = GetDeviceCaps(DC, PHYSICALWIDTH);

>   int phH  = GetDeviceCaps(DC, PHYSICALHEIGHT);

>

>   int LM = MulDiv(RVPrint->LeftMarginMM,   5*lpx, 127)- phoX;

>   int TM = MulDiv(RVPrint->TopMarginMM,    5*lpy, 127)- phoY;

>   int RM = MulDiv(RVPrint->RightMarginMM,  5*lpx, 127)-

(phW-(phoX+Width));

>   int BM = MulDiv(RVPrint->BottomMarginMM, 5*lpy, 127)-

(phH-(phoY+Height));

>

>   if (LM<0) LM = 0;

>   if (TM<0) TM = 0;

>   if (RM<0) RM = 0;

>   if (BM<0) BM = 0;

>

>   Width -= LM+RM;

>   Height -= TM+BM;

>

>   DeleteDC(DC);

>

>   DC = GetDC(0);

>

>   Width  = MulDiv(Width,  GetDeviceCaps(DC, LOGPIXELSX), lpx);

>   Height = MulDiv(Height, GetDeviceCaps(DC, LOGPIXELSY), lpy);

>

>   ReleaseDC(0, DC);

> }

>

>

>





Powered by ABC Amber Outlook Express Converter