By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,561 Members | 1,252 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,561 IT Pros & Developers. It's quick & easy.

Setting a Pixel

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
On Mon, 03 May 2004 22:56:56 GMT, "Bob Palank" <bo*@stlcc.org> wrote:
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 ;-}


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 discussion thread is closed

Replies have been disabled for this discussion.