View Issue Details

IDProjectCategoryView StatusLast Update
0010332Lazarus-public2008-04-24 10:08
ReporterMartin Friebe Assigned ToVincent Snijders  
Status closedResolutionno change required 
Target Version1.0.0 
Summary0010332: DrawGrid.Canvas.Pixel problem with x coords 256-511 (bit 8 set) (Windows)
DescriptionAccessing the canvas.Pixel property of a DrawGrid shows a strange behaviour.

You can Draw Lines, or use any function to draw anywhere on the Canvas. BUT if you use the Pixel[X,Y]:=TColor property you will experience a strange behaviour.
Any X coordinate with bit8 set (256-511, 768=1023, ...) will be ignored.

Using a TPaintbox, or TImage will work fine. Using Functions such as Rectangle or Line will also work (even on the TDrawGrid).
Additional InformationTo Reproduce, set up a new Application with a TButton and a TDrawGrid on a TForm

Ensure the Drawgrid is at least 600 pixel width.

add the following code to the ButtonClick, and run it:

procedure TForm1.Button1Click(Sender: TObject);
var i : integer;
  for i := 1 to 600 do begin
    DrawGrid1.Canvas.Pixels[i,1]:= clRed;

You will be noticing a 256 Pixel Gap in the Red line
TagsNo tags attached.
Fixed in Revision
Attached Files


related to 0015822 closedDmitry Boyarintsev vista/server 2008 SetPixel bug. 


Vincent Snijders

2007-12-03 17:51

manager   ~0016563

I cannot reproduce this issue. Can you create a example applictaion and a screenshot?

What windows version do you use?

What color depth do you use?

2007-12-04 03:22


canvas.rar (389,051 bytes)

Martin Friebe

2007-12-04 03:31

manager   ~0016572

I am running Windows Vista (Home Prem) 32Bit Version. Running on Intel Core2Duo.
Color deep is 32 bit.

The application is compiled with the settings for win32.

I get the issue using Lazarus 0.9.24 with fpc 2.2.0 (from sourceforge).
I also get it with the snapshot from 23 Nov (0.9.25 with fpc 2.2.1).

The ZIP contains Source, Exe, and a JPEG.

In the jpeg you can see a thin red line at the top of the grid. It should be continuous.

It is also notice-able that the issue exists only for the X-coordinate. If I draw the line along the Y-axis, it works.

Martin Friebe

2007-12-04 12:52

manager   ~0016586

This seems to be Windows VISTA only.

I tried the same exe (the exe that was compiled under Vista (and is in the attachment)), running this exe under Windows-XP, produces correct results.

Running it under Vista, produces the error.

Martin Friebe

2007-12-04 21:48

manager   ~0016594

This may be a bug in Vista, rather than Lazarus.

I have just created the same project with Turbo Delphi. (created a new project from scratch). Turbo Delphi has the same problem.

Vincent Snijders

2007-12-05 09:00

manager   ~0016598

Another Vista user checked and didn't report this problem. Maybe it has something to do with your specific Vista setup.

I will close this issue for Lazarus.

Issue History

Date Modified Username Field Change
2007-12-03 00:39 Martin Friebe New Issue
2007-12-03 00:39 Martin Friebe Widgetset => Win32
2007-12-03 03:28 Vincent Snijders LazTarget => 1.0
2007-12-03 03:28 Vincent Snijders Status new => acknowledged
2007-12-03 17:51 Vincent Snijders Note Added: 0016563
2007-12-03 17:51 Vincent Snijders Status acknowledged => feedback
2007-12-04 03:22 Martin Friebe File Added: canvas.rar
2007-12-04 03:31 Martin Friebe Note Added: 0016572
2007-12-04 12:52 Martin Friebe Note Added: 0016586
2007-12-04 21:48 Martin Friebe Note Added: 0016594
2007-12-05 09:00 Vincent Snijders Status feedback => resolved
2007-12-05 09:00 Vincent Snijders Resolution open => no change required
2007-12-05 09:00 Vincent Snijders Assigned To => Vincent Snijders
2007-12-05 09:00 Vincent Snijders Note Added: 0016598
2008-03-29 12:18 Marc Weustink Status resolved => closed
2008-04-24 10:08 Vincent Snijders Target Version => 1.0.0
2010-03-12 14:52 Vincent Snijders Relationship added related to 0015822