CWinFormsView has arbitrary minimum size?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MLM450@hotmail.com

    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?

    Thanks,
    Mike

  • MLM450@hotmail.com

    #2
    Re: CWinFormsView has arbitrary minimum size?

    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::Scroll ableControl ^scrlCtrl =
    dynamic_cast<Sy stem::Windows:: Forms::Scrollab leControl^>(Get Control());
    if (scrlCtrl != nullptr)
    {
    CRect rcView;
    GetClientRect(& rcView);
    System::Drawing ::Size size(0,0);
    scrlCtrl->AutoScrollMinS ize = size;
    }
    // *** End workaround

    Comment

    Working...