471,627 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Drawing Pixels

I am fairly new to .Net and C# but am familiar with the Win32 API.
I wish to set the pixels of the client area of a window one at a time
with a specific color. I have so far discovered that System.Drawing.Bitmap
has a SetPixel() method but I can't seem to find out how to have the bitmap
displayed. I would actually like to have the pixels appear as I set them.

Regards
Chris Saunders
Jan 26 '06 #1
3 2470
Check out the System.Drawing.Graphics class:

http://msdn.microsoft.com/library/de...classtopic.asp

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Who is Mighty Abbott?
A twin turret scalawag.

"Chris Saunders" <ev**@mountaincable.net> wrote in message
news:4a***************************@MOUNTAINCABLE.N ET...
I am fairly new to .Net and C# but am familiar with the Win32 API.
I wish to set the pixels of the client area of a window one at a time
with a specific color. I have so far discovered that
System.Drawing.Bitmap
has a SetPixel() method but I can't seem to find out how to have the
bitmap
displayed. I would actually like to have the pixels appear as I set them.

Regards
Chris Saunders

Jan 26 '06 #2
Thanks for the reply Kevin.

That class was the first place I looked but it does not appear
to provide for setting a pixel individually and having it appear
immediatly on the screen. So far all I have managed was to
use a System.Windows.Forms.PictureBox and a
System.Drawing.Bitmap, I use SetPixel for the
bitmap and then set the pictureBox.Image to the
bitmap. Even if I do pictureBox.Image = bitmap in
every iteration of the loop where I set the bitmap
pixels the redrawing does not appear until the loop
is finished.

I hope this explanation was clear enough.
Still hoping for a solution.

Regards
Chris Saunders

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:eF*************@TK2MSFTNGP12.phx.gbl...
Check out the System.Drawing.Graphics class:

http://msdn.microsoft.com/library/de...classtopic.asp

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Who is Mighty Abbott?
A twin turret scalawag.

"Chris Saunders" <ev**@mountaincable.net> wrote in message
news:4a***************************@MOUNTAINCABLE.N ET...
I am fairly new to .Net and C# but am familiar with the Win32 API.
I wish to set the pixels of the client area of a window one at a time
with a specific color. I have so far discovered that
System.Drawing.Bitmap
has a SetPixel() method but I can't seem to find out how to have the
bitmap
displayed. I would actually like to have the pixels appear as I set
them.

Regards
Chris Saunders


Jan 26 '06 #3
Hi Chris,

Your original question was regarding setting the pixels of the "client area
of a window." This is different than drawing on a bitmap, which is not a
window, nor the client area of a window.

Most drawing is not done using the few methods available in the
System.Drawing.Bitmap class, such as the SetPixel method. In fact, most
drawing done on Bitmaps is done via the Graphics class. I would suggest you
read up on it.

I think you would also benefit from the articles and tutorials at
http://www.bobpowell.net/.

The particular problem you seem to be describing is that you want the Bitmap
to appear immediately after you perform some drawing operation. If you could
be more specific about your business requirement, I could probably be of
more help. In the meantime, if you visit the references I mentioned, you may
not need any help.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Who is Mighty Abbott?
A twin turret scalawag.

"Chris Saunders" <ev**@mountaincable.net> wrote in message
news:13***************************@MOUNTAINCABLE.N ET...
Thanks for the reply Kevin.

That class was the first place I looked but it does not appear
to provide for setting a pixel individually and having it appear
immediatly on the screen. So far all I have managed was to
use a System.Windows.Forms.PictureBox and a
System.Drawing.Bitmap, I use SetPixel for the
bitmap and then set the pictureBox.Image to the
bitmap. Even if I do pictureBox.Image = bitmap in
every iteration of the loop where I set the bitmap
pixels the redrawing does not appear until the loop
is finished.

I hope this explanation was clear enough.
Still hoping for a solution.

Regards
Chris Saunders

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:eF*************@TK2MSFTNGP12.phx.gbl...
Check out the System.Drawing.Graphics class:

http://msdn.microsoft.com/library/de...classtopic.asp

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Who is Mighty Abbott?
A twin turret scalawag.

"Chris Saunders" <ev**@mountaincable.net> wrote in message
news:4a***************************@MOUNTAINCABLE.N ET...
I am fairly new to .Net and C# but am familiar with the Win32 API.
I wish to set the pixels of the client area of a window one at a time
with a specific color. I have so far discovered that
System.Drawing.Bitmap
has a SetPixel() method but I can't seem to find out how to have the
bitmap
displayed. I would actually like to have the pixels appear as I set
them.

Regards
Chris Saunders



Jan 27 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by johannblake | last post: by
reply views Thread by eruess | last post: by
8 posts views Thread by Benoit Martin | last post: by
3 posts views Thread by Dennis | last post: by
7 posts views Thread by Stefan0 | last post: by
2 posts views Thread by =?Utf-8?B?R2lkaQ==?= | last post: by
15 posts views Thread by javelin | last post: by

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.