Win32 GUI: resize a dialog
I have a basic Win32 dialog-based application. How do I make it resize?
If it was a window this would be possible by default (and it would fire WM_SIZE). I'm new to dialogs and I'm not able to figure out how to: 1. when mouse cursor hovers over the edge, it should change to IDC_SIZEWE or IDC_SIZENS, 2. just resize the dialog, I k开发者_JAVA百科now how to position dialog's content.
You don't need to do the work yourself about moving the cursor to the edge, there is just a style you need to set in the .rc file or the dialog editor.
From the dialog editor: Set the border to Resizing to allow resizing of the dialog box.
From editing the .rc file directly: Append | WS_THICKFRAME
to the line with STYLE
What window styles have you set on your dialog?
If you're using a framework such as MFC, you can repair a dialog that is no longer resizable by making sure the WS_THICKFRAME
/ WS_SIZEBOX
or other suitable window style is set. In some development environments, this may also be set in the properties for the dialog if you are using something with runtime support.
If you created the window manually, specify one or the other in your call to CreateWindow
/ CreateWindowEx
along with your other window styles. Some window styles, such as WS_OVERLAPPED
also imply a resizable frame.
Window Styles @ MSDN
CreateWindowEx @ MSDN
Note - I tried doing this by calling ModifyStyle() on the window in the onInit(). However it does not work. You get the resize cursor, but no sizing happens.
This apparently has to be set in the RC file or maybe eralier in the window creation.
精彩评论