As the documentation you linked clearly states, the Size
property is expecting an object of type System.Drawing.Size
. You are giving it an integer.
Try making a Size
object and setting it to that instead. Something like:
cartesianGrid.Size = new Size(5,5);