Hi all, is there a function in C# that is equivalent to the PutPixel function in VC++ 6.0 ? Please help !!
Hi all, is there a function in C# that is equivalent to the PutPixel function in VC++ 6.0 ? Please help !!
For as far as i know ( which is not much ) i dont think you have anything like that .... although a reasonable solution would be to have a PictureBox object and there you would be able to change every pixel , Ive seen examples where they edit a whole bitmap etc so drawing a single pixel on a picturebox wont be to difficult i think....
Since its something im interested in finding out as well ill take a look do some searches ( which of course you can do yourself as well ) and who knows i might come back with a working solution .
::edit::
After two times feeling lucky with google i found this
http://blogs.msdn.com/johnkenn/archi.../04/67465.aspx
It shows you didnt even tried to search for the answer yourself...
Oh and in case you didnt know the link above describes exactly what you want to do ( you would know if you checked it out ), it just needs some modification and then you can easily write your own Putpixel and getPixel method.
PS: sorry if im kinda rude but ive seen enough stupid questions all day long and im kinda tired of ppl who post a one liner and expect to get a working piece of code that does exactly what they asked for. Nex time show us you´ve tried and you´ve searched then come and ask if you dont understand any of the things you read.
Greetings,
Ganglylamb.
Last edited by GanglyLamb; 04-16-2005 at 06:37 PM.
Originally Posted by Salem
If you create a standard windows form, you use GDI+ to do the drawing in the Paint event handler of the form. The PaintEventArgs has a Graphics property you can use for drawing, have a look at that.
You can also create a Graphics object for the form by passing it the handle of the form:
That way you don't have to mess with the Paint event and have to invalidate the form to make it call Paint again.Code:Graphics g = Graphics.FromHwnd( formname.Handle )
On a side note this is something I learned today from my .NET game development book.