I have just spent quite a lot of time trying to make the Tools/Environment Options dialog of the Delphi 6/7 IDE sizable from within GExperts. Everything seemed to work fine until I found that changing the form's BorderStyle to bsSizable closes and recreates the handle of the form and in the process loses the content of the list box for the palette configuration. (The Items property is empty afterwards.)
Changing the form's size (by setting the height and width) as such works fine, but allowing the user to adjust the size runs into the aforementioned problem.
Is there any way to make a Delphi form sizable without changing the BorderStyle?
"Wnd" being the dialog handle, you can transform the dialog to an overlapped window with a sizing frame:
SetWindowLong(Wnd, GWL_STYLE,
GetWindowLong(Wnd, GWL_STYLE) and not WS_POPUP or WS_THICKFRAME);
remove the dialog frame:
SetWindowLong(Wnd, GWL_EXSTYLE,
GetWindowLong(Wnd, GWL_EXSTYLE) and not WS_EX_DLGMODALFRAME);
then attach the appropriate system menu item for sizing messages to be processed:
AppendMenu(GetSystemMenu(Wnd, False), MF_STRING, SC_SIZE, 'Size');
and have the new frame drawn:
SetWindowPos(Wnd, 0, 0, 0, 0, 0,
SWP_NOSIZE or SWP_NOMOVE or SWP_NOZORDER or SWP_FRAMECHANGED);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With