Thanks for the response
I got a bit further with this. (BTW this is all being done in worksheet startup)
What I have noticed is that calling Controls.Add(...) actaully resizes the user control to fit the dimensions of the range being supplied, in this case its doing it to the 1 cell, as I pass missing as the 2nd range parameter
In order to try and maintain the size I now do the following
//must get the size before we add the control double height = control.Height; gouble Width = control.Width;
Microsoft.Office.Tools.Excel.OLEObject oleControl; // missed this line in original post oleControl = Controls.AddControl(control, this.Range[cell, missing], name);
//now resize the OLEObject oleControl.Height = height; OleControl.Width = width;
This is mostly working. The values when breaking at this point are 330 (H) and 256 (W) . However after initialisation of the worksheet is complete, my user control looks quite a bit bigger than it should. Breaking again, I see these values are 440 and 341.
What is going on here? What is causing my control to be resized ??
Any help much appreciated.
To answer the previous questions, the user control has a number of controls on it (dateTimePicker's, ComboBox's, TextBox's and Label's )
|