Canvas control


I am using Real Studio 2011 Release 2 for Windows.

The commands below work when the canvas control array is on a regular window

Canvas1(1).Graphics.ForeColor = &cFF0000 'Red
Canvas1(1).Graphics.FillRect(2, 2, Canvas1(1).Width-3, Canvas1(1).Height-3)

However, When the control array is on a TabPanel that is on a regular window, the commands do not work.
Can anyone tell me the reason for this and the correct syntax?

Thanks in advance.

You should be doing this drawing in the Paint event of your Canvas control array and not drawing directly to the graphics class. This will also solve your issue of calling the canvases when on a tab panel. Use the index of the paint event to determine which canvas to draw to.