Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to draw with .NET Core?

Is there any way to draw and display graphics on the screen with .NET Core? I would like to create a graphics application that runs on multiple platforms.

like image 569
SuperJMN Avatar asked Jan 08 '17 18:01

SuperJMN


People also ask

Can you draw in C#?

Drawing in C# is achieved using the Graphics Object. The Graphics Object takes much of the pain out of graphics drawing by abstracting away all the problems of dealing with different display devices and screens resolutions. The C# programmer merely needs to create a Graphic Object and tell it what and where to draw.

What is System drawing in C#?

The Graphics class provides methods for drawing to the display device. Classes such as Rectangle and Point encapsulate GDI+ primitives. The Pen class is used to draw lines and curves, while classes derived from the abstract class Brush are used to fill the interiors of shapes.

Can you make desktop apps with .NET core?

Yes, it is possible to develop cross-platform desktop (GUI) applications, for Windows, Linux and macOS, using Visual Studio Code, . NET Core, C#, GTK 3, gtksharp and Glade as the GUI designer.

How do you add references to System drawing DLL?

Kartiikeya, in the Solution Explorer tab, right click on References and select "Add Reference...". Then click Assemblies, Framework, and scroll down until you see System. Drawing. Click the checkbox next to it, then click OK.


1 Answers

You can actually use OpenGL to draw graphics with .NET Core, but it seems a bit cumbersome, if you are just committed to using C# and not .NET Core maybe Unity is a better option for you.

If you are trying to make a "desktop application" with GUI elements you can also look into Electron combined with TypeScript (which is somewhat similar to C#), this is how they made Visual Studio Code for example

EDIT: I just found another very interesting article (by the same guy I've mentioned in the comments) called Building a 3D Game Engine with .NET Core, I'm pretty sure you can get some inspiration out of that how to use OpenTK, Veldrid and ImGui.NET for drawing on screen.

like image 145
Staeff Avatar answered Oct 12 '22 14:10

Staeff