You are not logged in.
Pages: 1
I hope to explain myself, but when I set the pen width to one pixel and draw on the VCLCanvas of a TPdfDocumentGDI, the line width comes out relatively thick, and I can't set the line width any smaller than 1 as Canvas.Pen.Width is an integer. Setting to zero doesn't help.
I need to draw a tiny width line on paper. Is there a way to achieve this with VCLCanvas? I know it can be done with PDF.Canvas, but I would have to change alot of code for compatibility
Thanks
FRITZ
Offline
You could increase the ScreenLogPixels value, so that it will increase the resolution of the VCLCanvas.
Default value is 72, but you could set it e.g. to 144.
The ScreenLogPixels must be set before the first use of VCLCanvas.
lPdf := TPdfDocumentGDI.Create;
try
lPdf.ScreenLogPixels := 144;
lPdf.Info.Author := 'Tester';
(...)
In this case, a VCLCanvas.Pen.Width of 1 will be smaller when rendered on pdf content.
Offline
You could increase the ScreenLogPixels value, so that it will increase the resolution of the VCLCanvas.
Default value is 72, but you could set it e.g. to 144.
The ScreenLogPixels must be set before the first use of VCLCanvas.
[...]
In this case, a VCLCanvas.Pen.Width of 1 will be smaller when rendered on pdf content.
I'm in the same situation to change the resolution, and I was very happy to read the "solution" here. Unfortunately "ScreenLogPixels" is a read only property (Version 1.12).
Please assist.
TIA
Offline
Did this solution work for you guys?
It didn't seem to for me. I tried setting ScreenLogPixels to 960 as a test and the rectangle still came out as 2 pixels thick. Setting ScreenLogPixels is working properly in terms of changing the resolution of the VCLCanvas, but does not seem to be changing the thickness of the lines as hoped.
Here is my rectangle draw code, FCanvas is set to the PDFDocumentGDI's VCLCanvas. The value being passed in for aWeight is 0. In the on-screen display of the canvas the lines are 1 pixel thick.
procedure drawbox(aWidth, aHeight: TInches; Color: TColor; PenStyle: TPenStyle; weight: integer);
var rect: TRect;
begin
// set the pen for the boundary
FCanvas.pen.Width := aWeight
FCanvas.pen.style := aStyle;
with FCanvas do begin
rect.left := FPositionX;
rect.Top := FPositionY;
rect.Right := FPositionX + aWidth;
rect.Bottom := rect.Top + aHeight + 1;
brush.Style := bsClear;
Rectangle( rect );
end;
end;
Last edited by Safetydan (2011-06-15 16:50:33)
Offline
Just and update. Using a width of 1 instead of 0 solved my problem.
Offline
Pages: 1