iOS Tutorial Bouncing smilay - Drawing with Canvas

Erel

Administrator
Staff member
Licensed User
A Canvas object allows you to draw over a view.

Canvas.Initialize expects a single parameter which is the target view.

You can then use the different drawing methods to draw over the view. The drawings will only be applied when you call Canvas.Refresh.

If the target view changes its size then you need to initialize the Canvas object again. This usually happens in Page_Resize event.
In this example we use two different canvas objects. cvsBackground is used to fill the root panel with a gradient.
Canvas1 draws over Panel1 which is a transparent panel. The smiley is drawn with Canvas1.

This video also demonstrates the hot code swapping feature.
Make sure to watch in HD mode (click on the small gear button).

Note that you should call Canvas.Release if it is no longer required.
You can create a Bitmap from the canvas layer with Canvas.CreateBitmap.
 

Attachments

Ariel

New Member
Licensed User
Congratulations on the contribution to the community basic4, you're a genius, I admire you. Can I compile the same project made basic4android? Regards Ariel
 
Top