views:

42

answers:

1

Hello,

this should be pretty simple but I don't get it. How can I draw a single point in .Net? If I use g.DrawLine(Black,0,0,0,0) nothing is drawn and if I use g.DrawLine(Black,0,0,1,0) a line with 2 dots is used. The same happens with g.DrawRectangle. This has me intrigued.

Thanks in advance.

EDIT: A box of 1x1 is a box of 4 pixels as can be shown at this image at IMAGESHACK:

+2  A: 

The easiest way is to fill a rectangle which is one pixel wide rather than using a pen:

 e.Graphics.FillRectangle(Brushes.Red, 42, 12, 1, 1);
Pete Kirkham
Rigth, the problem was using DrawRectangle instead of FillRectangle.
SoMoS
@SoMoS On my machine and every Windows machine I've used in the last fifteen years this has filled a single pixel. Are you sure that your 'proof' is *filling* a 1x1 rectangle, not *drawing* a 1x1 rectangle?
Pete Kirkham
Just check that I changed the comment before you write that ;)
SoMoS