Go Back   Wiki NewForum | Latest Entertainment News > Career Forum & Tips > Tech Forum & Tutorial > Oracle Database, SQL, Application, Programming


How to maximize without maximizing


Reply
Views: 2065  
Thread Tools Rate Thread
  #1  
Old 08-20-2010, 11:13 AM
bholas bholas is offline
Award Winner
 
Join Date: Apr 2010
Posts: 4,977
Default How to maximize without maximizing

When you maximize a Windows program, it will usually resize to fill up the full screen (minus the space occupied by primary controls such as the task bar). What if you don't want your application to change it's size to the size of the screen, yet you don't want to disable the maximize function? All you have to do is catch and handle the WM_GetMinMaxInfo message. Assuming that the name of your main form's class is TForm1 and that you want your application to "maximize" to half the size of the screen:
  1. Add the following declaration to the interface section of your application's main form (inside the private, public or protected declarations section):


    procedure _WM_GETMINMAXINFO(
    var mmInfo : TWMGETMINMAXINFO );
    message wm_GetMinMaxInfo;
  2. In the implementation section, type in the following code:


    procedure TForm1._WM_GETMINMAXINFO(
    var mmInfo : TWMGETMINMAXINFO );
    begin
    //
    // set the position and the size of
    // your form when maximized:
    //
    with mmInfo.minmaxinfo^ do
    begin
    ptmaxposition.x :=
    Screen.Width div 4;
    ptmaxposition.y :=
    Screen.Height div 4;

    ptmaxsize.x :=
    Screen.Width div 2;
    ptmaxsize.y :=
    Screen.Height div 2;
    end;
    end;


Reply With Quote
Reply

Tags
programming tips

New topics in Oracle Database, SQL, Application, Programming





Powered by vBulletin® Version 3.8.10
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
WikiNewForum)