[Gambas-user] Paint.LineWidth question

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


On Wed, 30 Sep 2015, Rolf-Werner Eilert wrote:
> This appears to be strange, though it might be just a misunderstanding.
> 
>   [code below]
>
> should draw a line, and it does. Now, if I want a thicker line, I set 
> LineWidth to... what? It is not documented.
> 
> I tried 2, I tried 10, I tried 100, but to no avail.
> 
> But maybe I misunderstand its function?
> 
> I used FillRect instead which does the same if you make it thin enough, 
> but I would feel better if I knew how to handle the line.
> 
>        Paint.LineWidth = 1
>        Paint.Color(Color.Black)

The Paint.Color() method just returns a PaintBrush object and does not
modify the Paint state. You want to set the Brush property with the return
value from Paint.Color():

  Paint.Brush = Paint.Color(Color.Black)

Alternatively, if you just want a solid color, you can use

  Paint.Background = Color.Black

>        Paint.MoveTo(x1, y1)
>        Paint.LineTo(x2, y2)
>        Paint.Fill()

Use Paint.Stroke() for (one-dimensional) lines, even if they are thick. Then
LineWidth should work, just set it to 10 for 10 units. Paint.Fill() is for
the two-dimensional area inside[*] your paint path, which was empty in your
case.

Regards,
Tobi

[*] Where the meaning of "inside" is determined by Paint.FillRule.

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




More information about the User mailing list