Sign in to follow this  

Pixels in C#

Recommended Posts

Is it possible to output a single pixel to the screen in pure C#, with no libraries or anything (no DirectX or OpenGL, etc.)? If so, what is the cleanest and quickest way to do so? And if there is some way, is it portable to other platforms or operating systems, or no? Any way to make it so? I'm not sure if this is possible but I am interested.

Share this post

Link to post
Share on other sites
Im assuming you dont mean without even the windows libraries.
Otherwise I cant really surely give you an answer.
With no libraries whatsoever im not sure but Id say probably not, becuase c# is a language mainly made for .net if Im not mistaken so why not use the .NET libraries?
You will probably always need something to comunicate with the operating system telling it to show certain imagery.

If you mean only the .net frameowrk then:
Its a simple control you can pull onto the window in vs .net calles a PictureBox.
You can use the picture box in te code by assigning it a bitmap:
someImage = new Image(width, height);

/here we draw to the screen
mypb.Image = someimage; //someimage is of type Image

Thats all.
As for cross platform: c# in itself isnt really cross platform although there are things in development like (mono if im not mistaken for linux).


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this