473,941 Members | 17,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting a Pixel

I think the ability to set a pixel on a graphics surface ought to be
straightforward and I tried to illict Dr. Guis opinion but he was too busy
to respond. So I think he must agree with me but fears authority ;-}
What do others think ? ? ? My original email and Dr. Gui's assistants reply
is shown below.
I'm worried about Dr. GUI and honestly believe he is hoarding the T-Shirts !

In fun
Bob Palank



Dear Dr. Gui

Years ago C and VB allowed us to place a single point on the graphics
surface. I liked _SetPixel(). Now it would seem to me that if you build a
new fancy shmansy language called C#, you ought to be able to place one
colored dot on the screen. Oh I know you can using FillRectangle, but this
seems like hammering a tack with a 10 pound mallet!

Would you ask the powerful people to consider fixing this, or have I missed
something ?

Yours faithfully,

Bob Palank

St. Louis

Thank you for sending a question to Dr. GUI at the Microsoft Developer
Network. Your questions are the

heart of the "Ask Dr. GUI" column. Dr. GUI regrets that due to his many
other duties

he CANNOT provide an individual answer to your question. One of Dr. GUI's
most important and time-consuming

duties is performing lobotomies on marketing and management trainees. (Just
joking, boss!) Dr. GUI doesn't

do house calls, either--even though he has been known to do Windows(R).
Instead of providing individual answers, Dr. GUI selects the

most interesting and/or important questions to run in the"Ask Dr. GUI"
column. You can read the column in the MSDN News

printed newspaper, on the MSDN Library CD-ROM, or on the Web at:

http://msdn.microsoft.com.

If your question is selected for a column, Dr. GUI will thank you by sending
you a neato-keen-way-cool MSDN T-shirt.


Nov 16 '05 #1
2 1450
Bob

Sorry Dr. GUI couldn't respond to your question. Why don't you just pinvoke SetPixel

Jackson Davi
-
This posting is provided "AS IS" with no warranties, and confers no right

Nov 16 '05 #2
On Mon, 03 May 2004 22:56:56 GMT, "Bob Palank" <bo*@stlcc.or g> wrote:
I think the ability to set a pixel on a graphics surface ought to be
straightforwar d and I tried to illict Dr. Guis opinion but he was too busy
to respond. So I think he must agree with me but fears authority ;-}


The problem is GDI+ which is either internally based on floating-point
coordinates, or at least pretends that it was. You see, GDI+ doesn't
know about "pixels". GDI+ has never heard of pixels. It provides a
drawing surface with real-world coordinates, hence a single point
would be a mathematical point and therefore invisible.

If you want to draw screen pixels, you have three options:
1. Use P/Invoke and the GDI SetPixel function, as Jackson said.
2. Create a Bitmap and use the Bitmap.SetPixel method.
3. Create a Bitmap, lock it, and set the pixel using bit manipulation.
--
http://www.kynosarges.de
Nov 16 '05 #3

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

Similar topics

6
8528
by: rzed | last post by:
I'm using PIL to generate some images which may be rotated at the user's option. When they are rotated, the original image is cropped in the new image (which is fine), and the corners are black (which is not, in this case). I can't find any documented way to change the default fill color (if that's what it is) for the corners, and PIL also doesn't seem to support a flood fill. I have created a flood fill in Python, which works but which...
12
3253
by: Jacob Weber | last post by:
Hello. Is it possible to specify the exact space between two lines, measured from the baseline of the top line to the ascenders of the second line? I tried adding the space with padding-bottom, but it adds it below the descenders. So the actual space between lines is larger than I specified. Jacob
1
6049
by: James Dean | last post by:
I get the following message when i try to set a pixel in the bitmap.......whats wrong and how can i fix it....... "Additional information: SetPixel is not supported for images with indexed pixel formats." this is the code......... bitmap.SetPixel(biheight,biwidth,Color.Black);
1
1681
by: James Dean | last post by:
I set the first 4 index values of the colorpalette to the following: 0 = white; 1 = red; 2 = blue; 3 = OverlapColor(mix of red and blue); So the first 4 bits will be used to to set one pixel.....so if i want to set it to red for instance i set the byte to a value of 1..........if i want to set the following pixel to red also i add the value 16 to the byte so two pixels side by side will have a byte value of 17.....4bits
7
3610
by: TomHL | last post by:
hello, - I have a Bitmap Object named: bmp1 - I already have the numerical values of:red,blue and green colors + I have the X and Y cordinates. How do I set the pixel value via safe code on the bmp1 object? (the pixel location based on the X & Y values and it's color based on the red,blue and green values the I already have)
3
6777
by: Marty McFly | last post by:
Hello, I have a control class that inherits from System.Web.UI.WebControls.Button. When I drag this control from the "My User Controls" tab in the toolbox onto the form, I want it to reflect the following default properties: Height = 32px, Width = 144px. I declare the Width property in my control as... \\\
2
3473
by: fripper | last post by:
I want to generate a graphic in a picture box control where the color of each pixel is determined by particular values calculated for each pixel. These values are manipulated in such a way that I come up with three values (each in the range 0-`55) and I want to use these for the RGB values of the color of the associated pixel. My question is: In VB 2005 how do I set a particular pixel to a color with a given set of RGB values? In VB 6 I...
2
2039
by: fripper | last post by:
I am using VB 2005 and want to generate a graphic in a picture box control where the color of each pixel is determined by particular values calculated for each pixel. These values are manipulated in such a way that I come up with three values (each in the range 0-155) and I want to use these for the RGB values of the color of the associated pixel. My question is: In VB 2005 how do I set a particular pixel to a color with a given set of...
1
1571
by: fripper | last post by:
In VB 2005ave a I have a picture control ("pix") on which I want to set each pixel color according to a variable, X, that has been calculated (I'm drawing fractals from the Mandelbrot Set). I use the statement: pix.SetPixel(i, j, myColor) where i and j are the coordinates of the pixel and myColor is a variable of type Color. Now X has a maximum value that it can attain (call it LimitX) and I want the color of a given pixel to be some...
0
1151
by: jfmck1965 | last post by:
Bought a used Compaq Presario running win 98. Problem was pixel setting was 640 x 480 and couldnt be changed. Was told a 'Trident' graphics dvr was removed and restoring it would fix the pixel problem. Bought a Trident dvr on ebay '3d 9759 driver win 95 98.exe' installed it but was already there. Appreciate any help with this issue. Thankls, Jim
0
10135
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
11531
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
11119
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11297
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9862
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
8219
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
7390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3509
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.