View Issue Details

IDProjectCategoryView StatusLast Update
0021806LazarusLCLpublic2012-04-20 01:12
ReporterAlexander S. Klenin Assigned ToPaul Ishenin  
Status resolvedResolutionno change required 
Product Version1.1 (SVN) 
Fixed in Version1.1 (SVN) 
Summary0021806: Brush.Style = bsClear is ignored
DescriptionThe code below

  with PaintBox1.Canvas do begin
    Brush.Style := bsClear;
    Brush.Color := clRed;
    Pen.Style := psDot;
    Pen.Color := clBlack;
    LineTo(100, 100);

draws red-black line instead of "transparent"-black.
This is a regression both compared to Delphi and Lazarus 0.9.30
Steps To ReproduceRun attached project.
TagsNo tags attached.
Fixed in Revision
Attached Files


2012-04-19 16:48


brush_clear.7z (1,583 bytes)

Zeljan Rikalo

2012-04-19 17:06

developer   ~0058769

Seem that latest brush patches created this problem, but afair in that patches was something that says -> if Brush.Color is changed then Brush is setted up to bsSolid ...

2012-04-20 00:26


lazarus_clear.png (1,893 bytes)   
lazarus_clear.png (1,893 bytes)   

2012-04-20 00:27


delphi_clear.png (1,597 bytes)   
delphi_clear.png (1,597 bytes)   

Luiz Americo

2012-04-20 00:39

developer   ~0058777

The behavior changed to 0.9.30 but now it's equal to Delphi.
See screenshots of Delphi and Lazarus version using the report code example.

I'm not saying that this behavior is correct or not.

In fact i noticed this difference between Lazarus and Delphi years ago while porting VirtualTreeView. At that time i reported the difference but the conclusion was that Lazarus behavior was the correct and should not be changed. See
You may also look at

Luiz Americo

2012-04-20 00:42

developer   ~0058778

More info: according to Delphi help Color property is ignored if Style is bsClear:

"Note: If the value of the Style property is bsClear, the Color property is ignored. Further, any value assigned to the Color property is lost when Style is set to bsClear."

Paul Ishenin

2012-04-20 00:43

manager   ~0058779

The issue is not a regression but instead logic fixing to match VCL.

If you set a color to brush and it style is bsClear then reset the style to bsSolid.

Screenshots added by Luiz shows how it works in delphi.

Luiz Americo

2012-04-20 00:46

developer   ~0058780

In the other side i did the following test in Delphi 7:

    if Brush.Style = bsClear then
    Brush.Color := clRed;
    if Brush.Style = bsSolid then

Both ShowMessage are executed so the Style really changes.

Maybe someone with newer Delphi can test

Alexander S. Klenin

2012-04-20 01:12

developer   ~0058781

Ok, but this is a serious incompatible change which should be
advertised in release notes.

Issue History

Date Modified Username Field Change
2012-04-19 16:48 Alexander S. Klenin New Issue
2012-04-19 16:48 Alexander S. Klenin File Added: brush_clear.7z
2012-04-19 16:48 Alexander S. Klenin LazTarget => -
2012-04-19 17:06 Zeljan Rikalo Note Added: 0058769
2012-04-19 17:06 Zeljan Rikalo Assigned To => Paul Ishenin
2012-04-19 17:06 Zeljan Rikalo Status new => assigned
2012-04-20 00:26 Luiz Americo File Added: lazarus_clear.png
2012-04-20 00:27 Luiz Americo File Added: delphi_clear.png
2012-04-20 00:39 Luiz Americo Note Added: 0058777
2012-04-20 00:42 Luiz Americo Note Added: 0058778
2012-04-20 00:43 Paul Ishenin Status assigned => resolved
2012-04-20 00:43 Paul Ishenin Fixed in Version => 1.1 (SVN)
2012-04-20 00:43 Paul Ishenin Resolution open => no change required
2012-04-20 00:43 Paul Ishenin Note Added: 0058779
2012-04-20 00:46 Luiz Americo Note Added: 0058780
2012-04-20 01:12 Alexander S. Klenin Note Added: 0058781