Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

How to limit resizing of an MDI window

Hi all,

Suppose I have an MDI app, using MFC, and I would like to be able to limit the resizing of a child window. For instance, it should be possible to set a min. or max. size limit, and prevent the user from resizing beyond these limits (e.g. too small or too big).
My attempts to a solution basically involve the WM_SIZE event (there does not seem to be a WM_SIZING event for the View class??), but nothing seems to have any effect. Also, MSDN documentation states that, when you call the base-class implementation of OnSize (for which a line of code is automatically inserted when you add a function for this event using the classwizard), the parameters you supply are not used at all, but instead it uses the original parameters from the event...

Anyone have a hunch, and willing to share ani insights?
Thanks in advance,
Mark


Comments

  • Sephiroth2Sephiroth2 Posts: 423Member
    : Hi all,
    :
    : Suppose I have an MDI app, using MFC, and I would like to be able to limit the resizing of a child window. For instance, it should be possible to set a min. or max. size limit, and prevent the user from resizing beyond these limits (e.g. too small or too big).
    : My attempts to a solution basically involve the WM_SIZE event (there does not seem to be a WM_SIZING event for the View class??), but nothing seems to have any effect. Also, MSDN documentation states that, when you call the base-class implementation of OnSize (for which a line of code is automatically inserted when you add a function for this event using the classwizard), the parameters you supply are not used at all, but instead it uses the original parameters from the event...
    :
    : Anyone have a hunch, and willing to share ani insights?
    : Thanks in advance,
    : Mark
    :
    :
    The WM_GETMINMAXINFO message is sent to a window when the size or position of the window is about to change. An application can use this message to override the window's default maximized size and position, or its default minimum or maximum tracking size.



  • MurmandamusMurmandamus Posts: 73Member
    : : Hi all,
    : :
    : : Suppose I have an MDI app, using MFC, and I would like to be able to limit the resizing of a child window. For instance, it should be possible to set a min. or max. size limit, and prevent the user from resizing beyond these limits (e.g. too small or too big).
    : : My attempts to a solution basically involve the WM_SIZE event (there does not seem to be a WM_SIZING event for the View class??), but nothing seems to have any effect. Also, MSDN documentation states that, when you call the base-class implementation of OnSize (for which a line of code is automatically inserted when you add a function for this event using the classwizard), the parameters you supply are not used at all, but instead it uses the original parameters from the event...
    : :
    : : Anyone have a hunch, and willing to share ani insights?
    : : Thanks in advance,
    : : Mark
    : :
    : :
    : The WM_GETMINMAXINFO message is sent to a window when the size or position of the window is about to change. An application can use this message to override the window's default maximized size and position, or its default minimum or maximum tracking size.
    :
    :
    :
    Hey, alright! I never thought of that message (Probably because I did not know it before). I tried it and it worked as one would expect. Thanks.


Sign In or Register to comment.