trichview.support
Re: Fit meatfile to page (reposted with subject line) |
Author |
Message |
horse |
Posted: 07/10/2002 13:16:20 GetScreenPageSize get the page size of print . now i have a position on richView canvas for example x:= 100; y := 300; then i want to change the coordinate of the point on richView to the coordinate of canvas in OnPagePrepaint. thanks "Sergey Tkachenko" <[email protected]> д����Ϣ���� > The procedure below returns a size of picture (in screen resolution) that > will fill a whole page. > > > procedure GetScreenPageSize(RVPrint: TRVPrint; > var Width, Height: Integer); > var DC: HDC; > phoX, phoY, phW, phH, lpy, lpx, LM, TM, RM, BM: Integer; > begin > DC := RV_GetPrinterDC; // from PtblRV unit > > Width := GetDeviceCaps(DC, HORZRES); > Height := GetDeviceCaps(DC, VERTRES); > > lpy := GetDeviceCaps(DC, LOGPIXELSY); > lpx := GetDeviceCaps(DC, LOGPIXELSX); > > phoX := GetDeviceCaps(DC, PHYSICALOFFSETX); > phoY := GetDeviceCaps(DC, PHYSICALOFFSETY); > phW := GetDeviceCaps(DC, PHYSICALWIDTH); > phH := GetDeviceCaps(DC, PHYSICALHEIGHT); > > LM := MulDiv(RVPrint.LeftMarginMM, 5*lpx, 127)- phoX; > TM := MulDiv(RVPrint.TopMarginMM, 5*lpy, 127)- phoY; > RM := MulDiv(RVPrint.RightMarginMM, 5*lpx, 127)- (phW-(phoX+Width)); > BM := MulDiv(RVPrint.BottomMarginMM, 5*lpy, 127)- (phH-(phoY+Height)); > > if LM<0 then LM := 0; > if TM<0 then TM := 0; > if RM<0 then RM := 0; > if BM<0 then BM := 0; > > dec(Width, LM+RM); > dec(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); > end; > > > > > I want to include a Chart in RichView. I make a metafile and insert it to > > Richview. How can I calulate the width of the metafile so it fits on the > > page when printing. > > > > There was a similar question on this newsgroup, where you suggested to use > > PrintAreaRect of OnPagePrepaint. However I would like to know that size > > before printing. Of course it depends of the printer chosen, but I could > > just use the default printer settings, or even a fixed size in Milimeters. > > It sould probably be the width in screen cooridnates because it is scaled > to > > printer resolution when printing, as I understand. > > > > Benedikt > > > > > > > > |
Powered by ABC Amber Outlook Express Converter