473,386 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 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 2584
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
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
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
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
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
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
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
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
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
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...

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.