### Bookstore

 Computer Math and Games in Pascal (preview) Lazarus Handbook

### Author Topic: Background Color for a Range?  (Read 378 times)

#### Jvan

• Full Member
• Posts: 121
##### Background Color for a Range?
« on: October 01, 2020, 02:21:13 am »
I'm using de the following code:

Code: Pascal  [Select][+][-]
1. for i:=0 to 10 do
2.       WriteBackgroundColor(0, i, RGBToColor(235, 235, 235));
3. for i:=0 to 10 do
4.       WriteBackgroundColor(1, i, RGBToColor(235, 235, 235));
5.

But maybe there is a way for a range.

#### winni

• Hero Member
• Posts: 2009
##### Re: Background Color for a Range?
« Reply #1 on: October 01, 2020, 01:25:14 pm »
Hi!

Tell us what  WriteBackgroundColor does.

Setting a pixel? If yes then just do:

Code: Pascal  [Select][+][-]
1. ....
2. With Canvas do
3. begin
4. Brush.color := RGBToColor(235, 235, 235);
5. Pen.Color := Brush.Color;
6. Rectangle (0,0,2,11);
7. end;
8.

Winni

#### paweld

• Full Member
• Posts: 248
##### Re: Background Color for a Range?
« Reply #2 on: October 01, 2020, 03:16:39 pm »
Code: Pascal  [Select][+][-]
1. for i:=0 to 10 do
2.   for j:=0 to 1 do
3.     WriteBackgroundColor(j, i, RGBToColor(235, 235, 235));
Best regards
paweld