473,499 Members | 1,568 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2589
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
8121
by: johannblake | last post by:
I am wondering whether it is easy to setup a coordinate system for drawing (using GDI+) that uses meters (or any custom scaling for that matter). Currently, I need to convert from pixels to meters...
0
2601
by: eruess | last post by:
Here's the scenario: I've got a whole bunch (for the sake of argument, let's say thousands) of different little 32x14 .png files that act as buttons all over a very large website. Each button...
8
5638
by: Benoit Martin | last post by:
I had to draw my own control because I couldn't find any control doing what I wanted it to do. This control has a grid that I need to have control over. To do that, I draw each line of the grid...
3
1642
by: Dennis | last post by:
I create a bitmap of 12 pixels wide x 15 pixels high then create a graphics object from the bit map. When I draw a rectangle g.DrawRectangle(blackpen, new rectangle(0,0,12,15)), I get the top and...
7
2113
by: Stefan0 | last post by:
Hi, I'd like to draw a circle on the screen using GDI+ I'm using the DrawEllipse method with width = height and I set the SmootingMode to SmoothingModeAntiAlias but the circle is "squared". Is...
4
10222
by: Dale | last post by:
I am creating GIF images with transparent backgrounds on-the-fly for a web app and rendering them by using System.Drawing.Image.Save(Response.OutputStream, ImageType.GIF). I am confident that...
1
1677
by: Sinem | last post by:
Hello I am making a drawing application where I want the user to be able to draw straight lines (quite similar to the line tool in Flash). I want them to be able to draw these lines at any angle...
2
13055
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, what is the unit of System.Drawing.Size? when i'm writing Size = (1024,784), is it pixel? or something else? Thanks,
15
4009
by: javelin | last post by:
I need to be able to create a javascript based drawing/signature box, and be able to save it. Can someone refer me to a script that will allow this, or even a 3rd party package for sale? It can't...
0
7009
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...
0
7178
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,...
0
7223
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...
0
5475
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,...
0
4602
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...
0
3094
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1427
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 ...
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
302
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...

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.