Trying to set a property on all canvases on one form

I’m trying to set the DoubleBuffer = True to all Canvases on a form if the program is running in Windows but I just can’t get the code right. Can someone please help?!?

    //
    // Adjustments for Win32
    //
    App.UseGDIPlus = True
    For Each Canvas In frmOakflat As picCanvas
      picCanvas.DoubleBuffer = True
    Next

The help file doesn’t have any examples using objects that I can find. TIA!

Try something like this in a method on the window
WARNING this is written entirely in the editor in the forums so it might only be “close”

For i as integer = 0 to Self.ControlCount() -1 if self.Control(i) isA picCanvas then picCanvas(self.Control(i)).DoubleBuffer = true end if next

Alternatively have a shared computed property on all these canvases that sets this property?

Or a constructor in the canvas subclass with

#if TargetWindows then me.DoubleBuffer = True