473,791 Members | 3,154 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(redP en, x, y, x+1, y);

Anyone know how to place one pixel on the surface ?

TIA

Bob


Nov 15 '05 #1
2 6109
Use DrawRectangle instead
----------------------
System.Drawing. Graphics gr;
gr = this.CreateGrap hics();
gr.DrawRectangl e(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.or g> wrote in message
news:D4******** **********@news read3.news.atl. earthlink.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(redP en, 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
1656
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 method I make, perhaps each pixel is randomly colored. I know there is the set pixel method, but thats not fast enough for such a large surface. So is there a way for me to prepare the image pixel by pixel without drawing it, and then send it to...
5
2514
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 lot. #include <stdio.h> #include <stdlib.h> #include <assert.h> struct Pixel {
4
12799
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
2248
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 Pat
8
39474
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 I have: g.DrawLine(myPen,x,y,x,y) nothing happens. I can have: g.DrawLine(myPen,x,y,x+1,y+1)
2
3138
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 get all kinds of screen artifacts and weirdness. My general goal is: list item with a few areas for text, every other item shaded a light color for readability, font color changes with selection. The listbox is populated with custom structurs...
5
2017
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 explain how to create a Point object, but not how to use it. I want to be able to plot individual pixels. I tried DrawEllipse, but that just draws circles. I reckon that I have to somehow use the Pen & the Point object. I don't want to draw lines. I...
4
16240
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
1345
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 of that display I receive a flag whether the pixel is to be drawn or not. Furthermore to display text you can imagine the surface as divided in 21 columns and 16 rows. Now for each cell I get information whether some letter is to be displayed in...
0
9669
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9517
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10428
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9997
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9030
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7537
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5435
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4110
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3718
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.