[Gambas-user] Paint.Rectangle question

Tobias Boege taboege at ...626...
Wed Sep 30 12:29:43 CEST 2015


On Wed, 30 Sep 2015, Rolf-Werner Eilert wrote:
> Is Paint.Rectangle to draw a filled rectangle or an empty one?
> 
> I tried
> 
>      Paint.LineWidth = 1
>      Paint.Color(Color.Black)
>      Paint.Rectangle(TabelleX, TabelleY, TblSpalteRechts[tblAnzSpalten] 
> - TabelleX, cy - TabelleY)
>      Paint.Fill()
> 
> and get a black filled rectangle. Even Paint.Color(Color.Transparent) 
> doesn't help.
> 
> Did I get this wrong, or is it buggy? Better to use Line? But then... 
> see my first question :)
> 

Paint.Rectangle() does not specify if the rectangle is filled or not. It
just adds a drawing path (in rectangular shape). If you use Paint.Fill()
on this drawing path, its inside (according to Paint.FillRule) is filled
with your current brush (in your case solid black color).

If you just want the border of the rectangle, you call Paint.Stroke() to
stroke just the lines of the path.

We have extensive chapters on Paint[0] and Cairo[1] in the Gambas-Buch,
if you want to have a look. Especially the project at [2], which is a big
compilation of Paint patterns and examples.

Regards,
Tobi

[0] http://www.gambas-buch.de/dw/doku.php?id=k23:k23.3:start
[1] http://www.gambas-buch.de/dw/doku.php?id=k25:k25.1:start
[2] http://www.gambas-buch.de/dw/doku.php?id=k23:k23.3:k23.3.4:k23.3.4.1:start

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk




More information about the User mailing list