我的窗口form1中放有多個 Panel對象,form的大小只有200*150 并且它們的Align屬性已設為alNone,
WindowStale屬性為wsNomal。程序在我的電腦上運行時, 窗口顯示正常。
    但程序在客戶的電腦上運行時, 窗口就好象變小了,窗口下方,右方有些內容看不見了。
    請問如何才能固定窗口的大小?

解决方案 »

  1.   

    如果想固定窗口大小,不让别人拖动,可以设置borderstyle:= bsSingle;
    你的问题可以看一下是不是系统设置的字体大小不一样,如客户的机器设置了大字体就后出现这种现象,我试一下
      

  2.   

    在Form的OnCreate事件里面:  Height := Screen.Height;
      Width := Screen.Width;
      

  3.   

    SetWindowLong
    The SetWindowLong function changes an attribute of the specified window. The function also sets the 32-bit (long) value at the specified offset into the extra window memory. Note  This function has been superseded by the SetWindowLongPtr function. To write code that is compatible with both 32-bit and 64-bit versions of Windows, use SetWindowLongPtr. LONG SetWindowLong(
      HWND hWnd,       // handle to window
      int nIndex,      // offset of value to set
      LONG dwNewLong   // new value
    );
    Parameters
    hWnd 
    [in] Handle to the window and, indirectly, the class to which the window belongs. 
    Windows 95/98: The SetWindowLong function may fail if the window specified by the hWnd parameter does not belong to the same process as the calling thread. nIndex 
    [in] Specifies the zero-based offset to the value to be set. Valid values are in the range zero through the number of bytes of extra window memory, minus 4; for example, if you specified 12 or more bytes of extra memory, a value of 8 would be an index to the third 32-bit integer. To set any other value, specify one of the following values. Value Action 
    GWL_EXSTYLE Sets a new extended window style. For more information, see CreateWindowEx.  
    GWL_STYLE Sets a new window style. 
    GWL_WNDPROC Sets a new address for the window procedure. 
    Windows NT/2000: You cannot change this attribute if the window does not belong to the same process as the calling thread.
     
    GWL_HINSTANCE Sets a new application instance handle. 
    GWL_ID Sets a new identifier of the window. 
    GWL_USERDATA Sets the 32-bit value associated with the window. Each window has a corresponding 32-bit value intended for use by the application that created the window. This value is initially zero. 
    The following values are also available when the hWnd parameter identifies a dialog box. Value Action 
    DWL_DLGPROC Sets the new address of the dialog box procedure. 
    DWL_MSGRESULT Sets the return value of a message processed in the dialog box procedure. 
    DWL_USER Sets new extra information that is private to the application, such as handles or pointers. dwNewLong 
    [in] Specifies the replacement value. 
    Return Values
    If the function succeeds, the return value is the previous value of the specified 32-bit integer.If the function fails, the return value is zero. To get extended error information, call GetLastError. If the previous value of the specified 32-bit integer is zero, and the function succeeds, the return value is zero, but the function does not clear the last error information. This makes it difficult to determine success or failure. To deal with this, you should clear the last error information by calling SetLastError(0) before calling SetWindowLong. Then, function failure will be indicated by a return value of zero and a GetLastError result that is nonzero.Res
    Certain window data is cached, so changes you make using SetWindowLong will not take effect until you call the SetWindowPos function. Specifically, if you change any of the frame styles, you must call SetWindowPos with the SWP_FRAMECHANGED flag for the cache to be updated properly. If you use SetWindowLong with the GWL_WNDPROC index to replace the window procedure, the window procedure must conform to the guidelines specified in the description of the WindowProc callback function. If you use SetWindowLong with the DWL_MSGRESULT index to set the return value for a message processed by a dialog procedure, you should return TRUE directly afterwards. Otherwise, if you call any function that results in your dialog procedure receiving a window message, the nested window message could overwrite the return value you set using DWL_MSGRESULT. Calling SetWindowLong with the GWL_WNDPROC index creates a subclass of the window class used to create the window. An application can subclass a system class, but should not subclass a window class created by another process. The SetWindowLong function creates the window subclass by changing the window procedure associated with a particular window class, causing the system to call the new window procedure instead of the previous one. An application must pass any messages not processed by the new window procedure to the previous window procedure by calling CallWindowProc. This allows the application to create a chain of window procedures. Reserve extra window memory by specifying a nonzero value in the cbWndExtra member of the WNDCLASSEX structure used with the RegisterClassEx function. You must not call SetWindowLong with the GWL_HWNDPARENT index to change the parent of a child window. Instead, use the SetParent function. 
      

  4.   

    SORRY,发错贴啦!应该是:
    在Form的OnCreate事件里面加上几句改变Form大小的语句。
    例如,窗口最右下角的控件是Contrl1,那么在OnCreate里可以这么写:
    width := Control1.left + Control1.width + 20;
    height := Control1.top + Control1.height + 20;
    这样,不管别的机器分辩率是多少,都能看见FORM里所有内容啦!
      

  5.   

    to: all
    我電腦的分辯率為800*600客戶電腦也800*600是字体及大小好象也沒有變化。
    再說我的窗口只有200*150大小,到底為什么?
    to: albert() 
    老兄,我英文不怎么好?
    您可不可以用中文解釋一下, 
    謝謝!!!
      

  6.   

    如 stanely(俺是邢她汉子) 所说,设scaled:= False;就可解决了
    你可以在显示属性的设置\高级\常规里看到字体大小的不同
      

  7.   

    设置窗体的属性constraints下的
    maxwidth
    maxheight
    minwidth
    minheight
    就可以了,我看上面的回答怎么都在误导呀!