# Drawing a line on the right border of the screen

**URL:** https://discourse.processing.org/t/drawing-a-line-on-the-right-border-of-the-screen/2949
**Category:** Processing
**Created:** [August 25, 2018, 4:09pm UTC](https://discourse.processing.org/t/drawing-a-line-on-the-right-border-of-the-screen/2949 "2018-08-25T16:09:09Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![ddownn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/ddownn/32/2731_2.png) [@ddownn](https://discourse.processing.org/u/ddownn)
#### Post date: [August 25, 2018, 4:09pm UTC](https://discourse.processing.org/t/drawing-a-line-on-the-right-border-of-the-screen/2949/1 "2018-08-25T16:09:09Z")

</div>

I am trying to draw a grid of 60px squares with a 1 pixel border in a page width of 540px, and I want the outline of each to be visible, but the right edge of the grid lines never show up.

I have reduced the problem down to the fact that if I draw a line at the right edge of the canvas, it simply never appears. (unless I change the strokeWidth to 2 or more.)

How can you draw a line within the bounds and have it never show up?

This is really annoying and I would like to know if there is a solution.

Here is a basic example of the problem.

```auto
void setup() {
  size(100, 100);
}
void draw() {
  stroke(0);
  strokeWeight(1);
  line(100, 0, 100, 100);
}

```

---

<div class="post-metadata">

### Author: ![jb4x](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jb4x/32/789_2.png) [@jb4x](https://discourse.processing.org/u/jb4x)
#### Post date: [August 25, 2018, 4:50pm UTC](https://discourse.processing.org/t/drawing-a-line-on-the-right-border-of-the-screen/2949/2 "2018-08-25T16:50:32Z")

</div>

If your canvas size is 100\*100 the border is not at x = 100 but x = 99, it starts at 0.

Check this example:

```auto
void setup() {
  size(100, 100);
}
void draw() {
  stroke(0);
  strokeWeight(1);
  line(0, 0, 0, 100);
  line(99, 0, 99, 100);
}

```

It draws a line in the first “column” and the last one

---

<div class="post-metadata">

### Author: ![ddownn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/ddownn/32/2731_2.png) [@ddownn](https://discourse.processing.org/u/ddownn)
#### Post date: [August 25, 2018, 6:35pm UTC](https://discourse.processing.org/t/drawing-a-line-on-the-right-border-of-the-screen/2949/3 "2018-08-25T18:35:00Z")

</div>

Thanks, I can’t believe I overlooked that.

I have been trying for so long to get the look of graph paper with 60px squares in a screen width which is a multiple of 60 and still be able to see the grid line on the far right squares, and it seems like no matter what I do the line on the right and bottom is very light or not visible.

I guess basically I will have to accept that one of the columns will have to be narrower by 1px, or that the gridlines will have to be at least 2px.

Thanks again.

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [September 10, 2018, 6:41pm UTC](https://discourse.processing.org/t/drawing-a-line-on-the-right-border-of-the-screen/2949/4 "2018-09-10T18:41:19Z")

</div>

> [@ddownn](#):
>
> I am trying to draw a grid of 60px squares with a 1 pixel border in a page width of 540px

> [@ddownn](#):
>
> I guess basically I will have to accept that one of the columns will have to be narrower by 1px, or that the gridlines will have to be at least 2px.

Not necessarily. You can make all columns the same size. Column dividers always equal columns+1. 2 columns are framed by 3 lines, 10 columns by 11, 100 by 101, etc.

So just add one to your canvas size.

If you want 10 columns of 9 pixels wide, as in your example: 10\*9 + 10 = 101

`size(101, 101);`

It sounds like you want 9 columns of 59, framed by 10 lines. 9\*59 + 10 = 541, so:

`size(541, 541);`

---

<div class="post-metadata">

### Author: ![ddownn](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/ddownn/32/2731_2.png) [@ddownn](https://discourse.processing.org/u/ddownn)
#### Post date: [September 11, 2018, 12:42pm UTC](https://discourse.processing.org/t/drawing-a-line-on-the-right-border-of-the-screen/2949/5 "2018-09-11T12:42:13Z")

</div>

Yes, that is what I came to realize. Thanks for taking the time to explain it
