I am using CWinFormsView to host my C# control. When I resize the view
window to a larger size the control seems to grow with it just fine.
But when I shrink the size of the view, I get scroll bars. I don't want
scrollbars, I want the control to shrink.
In the .NET control, I have tried adjusting the minimum size and the
auto size mode properties. In my view, I have tried setting the
controls size when the view is resized. None of this has helped.
Any suggestions?
Thanks,
Mike
MLM450@hotmail.com - 11 Aug 2006 16:51 GMT
In case anybody else out there is struggling with this issue too, I
have found the solution. Apparently it is a bug that is not discussed
in the Micorosoft documentation. The only reference I can find on it is
in their CWinFormsView sample app. In OnInitialUpdate, add the
following code after the call to the parent's OnInitialUpdate.
// *** Workaround bottom dock initial sizing issue
System::Windows::Forms::ScrollableControl ^scrlCtrl =
dynamic_cast<System::Windows::Forms::ScrollableControl^>(GetControl());
if (scrlCtrl != nullptr)
{
CRect rcView;
GetClientRect(&rcView);
System::Drawing::Size size(0,0);
scrlCtrl->AutoScrollMinSize = size;
}
// *** End workaround