Re: Drawing Pixels

Tech-Archive recommends: Speed Up your PC by fixing your registry



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" <evas@xxxxxxxxxxxxxxxxx> wrote in message
news:13a29$43d951c2$18d55654$15845@xxxxxxxxxxxxxxxxxxxx
> 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" <kevin@xxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:eFrEZkoIGHA.528@xxxxxxxxxxxxxxxxxxxxxxx
>> Check out the System.Drawing.Graphics class:
>>
>> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdrawinggraphicsclasstopic.asp
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> .Net Developer
>> Who is Mighty Abbott?
>> A twin turret scalawag.
>>
>> "Chris Saunders" <evas@xxxxxxxxxxxxxxxxx> wrote in message
>> news:4a9ac$43d87b05$18d55654$25861@xxxxxxxxxxxxxxxxxxxx
>>>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
>>>
>>
>>
>
>


.



Relevant Pages

  • GetPixel Versus Dibsection -- A subtle problem
    ... I have two methods for getting pixel info from an application window. ... The other is to create a bitmap using ... pixels into the bitmap. ... // bitmap must be a dibsection ...
    (microsoft.public.win32.programmer.gdi)
  • Re: How expensive are gdi drawing functions?
    ... 100-pixel high bitmap to hold it. ... given that graphics are now about 100 times faster (using modern ... you can reduce the number of pixels by deciding how accurate your ... lets say the chart is 100 pixels across, and the min(first window value) ...
    (microsoft.public.vc.mfc)
  • Re: How to bypass dialog box and window and create bitmap frames for animations of scrolling an list
    ... Can someone point me to an example of drawing to a GDI+ bitmap without ... instead of a window and then scroll the contents of the listbox by ... I don't know how to create a listbox outside of the context of a dialog ...
    (microsoft.public.win32.programmer.gdi)
  • Re: Problem with SavePicture, and a question on new versions
    ... > mode does not have to be in pixels. ... 500 pixels then the picture box will also be 700 x 500 pixels. ... and the bitmap shows ... to be *smaller* than the scale units that the BitBlt API is using ...
    (comp.lang.basic.visual.misc)
  • Re: Problem drawing in the window
    ... client area is covered with a bitmap. ... sluggish and the drawing blinks occasionally. ... Are you drawing the bitmap onto the window, and then drawing on top of that, ... Then, each time the window is repainted, simply draw the in-memory bitmap ...
    (microsoft.public.win32.programmer.gdi)