不想让主窗体出现滚动条? 怎么办?
我把窗体属性的AutoScroll设置为false..但是还是出现...郁闷 呢

解决方案 »

  1.   

    我建一个子窗体的时候:
        Tfrm_Product *PrdChild;
        PrdChild  = new Tfrm_Product(Application);
        PrdChild->Height = this->ClientHeight * 0.80;
        PrdChild->Width = this->ClientWidth *85;我拖动子窗体就会出现滚动条...
    我想子窗体刚好占满主窗体的客户区....不知怎么控制好...还有就是怎么拖动子窗体也不要出现滚动条
      

  2.   

    这好像是个难题....没人知道么....看到一个要说什么修改delphi中的源码才行呀...晕晕中..
      

  3.   

    靠,小case,耍点小道道就可以了,,1.在你的主窗口单元Unit1.cpp添加两个全局变量,保存child窗口的height,width//---------------------------------------------------------------------------
    #include <vcl.h>
    #pragma hdrstop#include "Main.h"
    #include "About.h"
    //---------------------------------------------------------------------------
    #pragma resource "*.dfm"
    TMainForm *MainForm;//MDI主窗口变量
    //---------------------------------------------------------------------------
    int i_ChildWidth=0;//添加两个全局变量,初始值为0
    int i_ChildHeight=0;
    2.修改你的上面的代码,添加个if语句
        Tfrm_Product *PrdChild;
        PrdChild  = new Tfrm_Product(Application);
        PrdChild->Height = this->ClientHeight * 0.80;
        PrdChild->Width = this->ClientWidth *85;    //添加下面这个if语句
        if (i_ChildWidth == 0)
        {
          Tile();
          i_ChildWidth = Child->Width;
          i_ChildHeight = Child->Height;
        }
        else
        {
            Child->Height = i_ChildHeight;
            Child->Width =i_ChildWidth;
        }搞定~~~
      

  4.   

    哦,上面的变量Child是我的测试代码,应该改为LZ的变量,Tfrm_Product *PrdChild;
    PrdChild = new Tfrm_Product(Application);
    PrdChild->Height = this->ClientHeight * 0.80;
    PrdChild->Width = this->ClientWidth *85;//添加下面这个if语句
    if (i_ChildWidth == 0)
    {
    Tile();
    i_ChildWidth = PrdChild->Width;
    i_ChildHeight = PrdChild->Height;
    }
    else
    {
    PrdChild->Height = i_ChildHeight;
    PrdChild->Width =i_ChildWidth;
    }
      

  5.   

    >>我想子窗体刚好占满主窗体的客户区....不知怎么控制好..上面的代码,仅仅是实现这个要求对禁止主窗体的滚动条,参考另一个帖子.
      

  6.   

    实现隐藏父窗体的滚动条
    //父窗体
    //Unit1.h
    class TForm1 : public TForm
    {
    __published: // IDE-managed Components
    private: // User declarations
    public: // User declarations
      __fastcall TForm1(TComponent* Owner);
      void __fastcall ClientWndProc(TMessage& Message); //++
      TFarProc NewClientWndProc;                        //++
      TFarProc OriginalClientWndProc;                   //++
    };//父窗体
    //Unit1.cpp
    __fastcall TForm1::TForm1(TComponent* Owner)
      : TForm(Owner)
    {
    NewClientWndProc = 0;
    OriginalClientWndProc = 0;
    NewClientWndProc = MakeObjectInstance(ClientWndProc);
    OriginalClientWndProc=reinterpret_cast<void*>(SetWindowLong(ClientHandle,GWL_WNDPROC,reinterpret_cast<LONG>(NewClientWndProc)));
    }
    //---------------------------------------------------------------------------
    void __fastcall TForm1::ClientWndProc(TMessage& Message)
    {
    //-------------------------------//
    // Perform Message Handling Here //
    //-------------------------------//
    //不显示滚动条
    ShowScrollBar(ClientHandle,SB_BOTH,false);
    // Then call the original WndProc() for the other messages
    if(OriginalClientWndProc != 0)
    {
    Message.Result= CallWindowProc(reinterpret_cast<FARPROC>(OriginalClientWndProc),ClientHandle,Message.Msg,Message.WParam,Message.LParam);
    }
    }