What is equivalent to a Java canvas object in C #?

I am working on creating a basic application that will allow the user to draw (using a series of dots), and I plan to do something with these dots.

If it was Java, I think that probably I would use a canvas object and some Java2D calls to paint what I want.

All the tutorials that I read in C # / Drawing include creating your own drawing method and adding it to the drawing event for the form. However, I am interested in having some traditional Form controls, and also I do not want to draw them. So, is there a “Canvas” object where I can limit what I draw?

Also, is WinForms a bad choice considering this use case? Will WPF have more features to help me do what I want? Or Silverlight?

+3
source share
2 answers

The bitmap will work fine by displaying it using the PictureBox.Image property. Use Graphics.FromImage () to get the Graphics object that you will need to draw from the bitmap. Use PictureBox.Invalidate () so that PB knows that it needs to refresh the image on the screen.

+2
source

, control, "" WPF, . Windows Forms, , . Windows . , - . WPF - "". , - , .NET 2.0, WPF (, , WPF ).

0

Source: https://habr.com/ru/post/1739333/


All Articles