Board index » delphi » Drawing Pen.Width under Windows XP

Drawing Pen.Width under Windows XP


2004-12-15 07:26:42 PM
delphi202
I recently acquired a new computer (Pentium 4, 2.4 MHz) which came with
Windows XP Professional.
(I previously used a Pentium 3, 500 MHz with 98SE). I am using Delphi 6
Personal.
In a graphics program that I have been using for a long time, I find under
XP that the bottom
parts of graphic images do not appear correctly on the screen.
Narrowing down the problem, I come to Pen.Width.
In the program below, a straight line is drawn from top to bottom of a
TImage, with each end marked with a cross-line.
When Pen.Width is set to 1 the line stops before the bottom is reached
and the bottom cross-line does not appear. (The TImage is taller than
the form Clientheight.)
When Pen.Width is set to greater than 1, the lines appear correctly over the
full height.
The same program (compiled under XP) works correctly under 98SE with
Pen.Width equal to or greater than 1.
Have I been doing something wrong all along, but it shows up only under XP?
Do I need a later version of Delphi?
Can anyone advise me on this please?
Chris Dixon
Sydney, Australia
PROGRAM XPDraw;
uses
Classes, Controls, Dialogs, ExtCtrls, Forms, Graphics,Windows;
{$R *.RES}
VAR
Form1:TForm;
Img1:TImage;
Rect1:TRect;
BEGIN
WITH Application DO
BEGIN
Initialize;
Form1:=TForm.CreateNew(Application);
WITH Form1 DO
BEGIN
Caption:='Pen Width Test';
{ Fit Form to Screen }
SystemParametersInfo(SPI_GETWORKAREA,0,@Rect1,0);
WITH Rect1 DO
BEGIN
Width:=Right-Left;
Height:=Bottom-Top;
END;
{ Add TImage }
Img1:=TImage.Create(Form1);
InsertControl(Img1);
WITH Img1 DO
BEGIN
Width:=Form1.ClientWidth;
Height:=2*Form1.ClientHeight;
WITH Canvas DO
BEGIN
{ Draw Line with Cross Pieces }
Pen.Width:=2; {cuts out if 1; OK if>1}
MoveTo(80,0);
LineTo(120,0);
MoveTo(100,0);
LineTo(100,Height);
MoveTo(80,Height-1);
LineTo(120,Height-1);
END;
END;
ShowModal;
END;
END; {Application}
END.
 
 

Re:Drawing Pen.Width under Windows XP

I am now answering my own question (Wed, 15 Dec 2004 22:26:42 +1100)
(or partially, at least).
My new computer came with XP Pro
already installed. I updated XP to
Service Pack 2.
However, I wanted to put the system onto
a different hard disk. So I used the XP
and motherboard disks that came with
the computer to install from scratch
on the other disk.
After installing, things did look a little
different, in minor ways. I upgraded
to SP2 again.
The problem described in my previous
message has disappeared!
Apparently the original installation
differed in some way from the current one.
Maybe the difference is in XP, maybe
it is in the graphics system, maybe it
is something else. (The motherboard on
my computer has an inbuilt display
adaptor: Intel 83845G Graphics controller
the driver being on the motherboard
disk).
I provide this information, in case it
is of use to anyone else encountering
a similar problem.
Chris Dixon
On Wed, 15 Dec 2004 22:26:42 +1100, "Chris Dixon"
<XXXX@XXXXX.COM>writes: