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.
            Asked
            
        
        
            Active
            
        
            Viewed 4,902 times
        
    7
            
            
         
    
    
        Zoe
        
- 27,060
- 21
- 118
- 148
 
    
    
        Ignacio Soler Garcia
        
- 21,122
- 31
- 128
- 207
- 
                    1possible duplicate of [Draw a single pixel on Windows Forms](http://stackoverflow.com/questions/761003/draw-a-single-pixel-on-windows-forms) – H H Jun 15 '10 at 15:46
1 Answers
9
            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
        
- 48,893
- 5
- 92
- 171
- 
                    1Rigth, the problem was using DrawRectangle instead of FillRectangle. – Ignacio Soler Garcia Jun 15 '10 at 15:48
- 
                    @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 Jun 15 '10 at 15:51
- 
                    Just check that I changed the comment before you write that ;) – Ignacio Soler Garcia Jun 15 '10 at 15:55