trichview.support
Re: printer problem |
Author |
Message |
Sergey Tkachenko |
Posted: 04/12/2002 12:36:45 Hi, Coordinates on the printer canvas are measured in pixels. So width of 50 pixels on the 300dpi printer will be twice larger than on the 600dpi printer (dpi = dots per inch, i.e. pixels per inch). You need to multiply all coordinates on value proportional to dpi. So, if your logo looks correct on the 300dpi printer, then use formulas horz_coordinate = Round( pixels * horz_dpi / 300 ) vert_coordinate = Round( pixels * vert_dpi / 300 ) where horz_dpi = GetDeviceCaps(Canvas.Handle, LOGPIXELSX); vert_dpi = GetDeviceCaps(Canvas.Handle, LOGPIXELSY); > Hi, > I've written a code which draw a logo on RVPrint1's canvas with graphic > functions. > it was shown correctly in my printer(it is 300dpi) > but in 600dpi printer, it was shown with small size. > > I don't know why? > > following is my codes > ---------------------------------------------------------- > procedure TForm1.RVPrint1PagePrepaint(Sender: TRVPrint; PageNo: Integer; > Canvas: TCanvas; Preview: Boolean; PageRect, PrintAreaRect: TRect); > begin > // DrawMargins1(Canvas, PrintAreaRect, PageNo); > DrawMargins2(Canvas, PrintAreaRect, PageNo); > end; > > rocedure TForm1.DrawMargins2(Canvas: TCanvas; > const R: TRect; PageNo: Integer); > var > PageLeft : integer; > PageNoStr : String; > begin > .... > DrawGPMark2(Canvas,R.Right-430,R.Bottom + 60, 50, 50); > .... > end; > > procedure TForm1.DrawGPMark2(Canvas: TCanvas; x,y,width,height : integer); > var > Depth : integer; > x2,y2 : integer; > small_width , small_height : integer; > bios : integer; > begin > Canvas.Pen.Width := 4; > Canvas.Pen.Style := (psSolid); > > Depth := round(width * 15/50); > bios := round(height * 8/50); > > x2 := x+width; y2 := y+height; > small_width := (x2-x) div 2; > small_height := (y2-y) div 2; > > SetMapMode(Canvas.Handle, MM_ANISOTROPIC); > Canvas.Ellipse(x,y,x2,y2); > > Canvas.Ellipse(x+Depth,y+Depth,x2-Depth,y2-Depth); > Canvas.Arc( > x,y+depth-bios, > x2-depth,y2-depth+bios, > > x,y+depth+(small_height div 2) , > x2-depth,y+depth+(small_height div 2) > ); > Canvas.Arc( > x+depth,y+depth-bios, x2,y2-depth+bios, > x2,y+depth+(small_height div 2), > x+depth,y+depth+(small_height div 2) > ); > end; > > > |
Powered by ABC Amber Outlook Express Converter