I thought this would be simple, but it's proving to be otherwise. I need to determine the dimensions of a PictureBox at runtime, add the control, then draw onto that control using PSet.

My preferred method is to Load a new element of a control array, then specify ScaleWidth and ScaleHeight, but these attempts are ignored at runtime. Otherwise this method would work - I can set its position on the form, but not its dimensions. <img src=/S/confused.gif border=0 alt=confused width=15 height=20>

Failing that, I tried <code>Dim WithEvents picTwo As VB.PictureBox</code> and found that I could add and resize the new PictureBox, but as soon as I had finished drawing into it, the new image disappeared. This method will be unsatisfactory anyway though, since there will be an indefinite number of PictureBox controls added.

Any suggestions on how I might achieve this please?


BTW, a 3rd party custom control/ OCX is not an option here.