473,324 Members | 2,511 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Point Clouds - Draw One Pixel

Anyone ever try to place one pixel on the drawing surface ?

The code below provides two pixels. When x+1 is changed to x, nothing is
drawn. So I guess the shortest line is two pixels.

Graphics g = e.Graphics; // Grt a drawing Surface
Pen redPen = Pens.Red;
int x = 50;
int y =50;
g.DrawLine(redPen, x, y, x+1, y);

Anyone know how to place one pixel on the surface ?

TIA

Bob


Nov 15 '05 #1
2 6091
Use DrawRectangle instead
----------------------
System.Drawing.Graphics gr;
gr = this.CreateGraphics();
gr.DrawRectangle(new Pen(Color.Blue ),10,10,1,1);
--------------------

The last two arguments provide height and width options. Set to 1 and they
ought to draw a single pixel.
"Bob Palank" <bo*@stlcc.org> wrote in message
news:D4******************@newsread3.news.atl.earth link.net...
Anyone ever try to place one pixel on the drawing surface ?

The code below provides two pixels. When x+1 is changed to x, nothing is
drawn. So I guess the shortest line is two pixels.

Graphics g = e.Graphics; // Grt a drawing Surface
Pen redPen = Pens.Red;
int x = 50;
int y =50;
g.DrawLine(redPen, x, y, x+1, y);

Anyone know how to place one pixel on the surface ?

TIA

Bob

Nov 15 '05 #2
I think if you draw with -1 as the size it should be one pixel.

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ivan D | last post by:
(planning to do this in C#) plz, if you know tell me :) Im interested in handling the drawing to a surface manually pixel by pixel. For example I want to draw a 640x480 image according to some...
5
by: George | last post by:
I cannot understand how to fix my code so that it will work. It needs to draw a series of lines in different colors and save it to a ppm file. Could someone tell me what I have done wrong. Thanks a...
4
by: Pat Keel | last post by:
Hi there, Im looking for a solution to draw a one pixel sized point to a graphics control. E.g. DrawLine(10,10, 11,11) draws 2 pixels, DrawLine(10,10, 10,10) has no effect. How to do? Thanks Pat
1
by: Pat Keel | last post by:
Hi there, I'm looking for a solution to draw a one pixel sized point to a graphics control. E.g. DrawLine(10,10, 11,11) draws 2 pixels, DrawLine(10,10, 10,10) has no effect. How to do? Thanks...
8
by: MC D | last post by:
Ok, dumb question, but how do you draw a single point in gdi? I thought you could use the .DrawLine method and just specify the same start and end point, but that does nothing. In otherwords, if...
2
by: dan heskett | last post by:
I am owner-drawing a listbox, in an attempt to create a nice list with some custom "fields" and text layout. Essentially it works, but I must be missing something big, conceptually, because I...
5
by: pcnerd | last post by:
I want to create a program that will do graphics like math functions & fractals & stuff. I've been browsing thru books at the bookstores. Apparently, the Point object replaced Pset. The books...
4
by: Roger Frost | last post by:
I need to draw a single point with WPF but there doesn't seem to be a class that represents the most fundamental geometric object. Any idea's? -- Roger Frost "Logic Is Syntax Independent"
0
by: Kevinst | last post by:
Hello, currently I am working on the following scenario: There is a device connected to my application. That device has a 256x256 pixel display showing graphics and text. Now for each pixel...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.