470,811 Members | 1,124 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,811 developers. It's quick & easy.

CWinFormsView has arbitrary minimum size?

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?


Aug 10 '06 #1
1 1703
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::ScrollableCon trol^>(GetControl());
if (scrlCtrl != nullptr)
CRect rcView;
System::Drawing::Size size(0,0);
scrlCtrl->AutoScrollMinSize = size;
// *** End workaround

Aug 11 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

17 posts views Thread by Adam H. Peterson | last post: by
3 posts views Thread by Harry_Crow | last post: by
12 posts views Thread by David Sworder | last post: by
1 post views Thread by Wilfried Mestdagh | last post: by
1 post views Thread by MLM450 | last post: by
2 posts views Thread by =?Utf-8?B?Qm9iIFdhaXRl?= | last post: by
158 posts views Thread by jty0734 | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.