g6101
高階會員
發表:22 回覆:129 積分:110 註冊:2002-06-15
發送簡訊給我
|
大家好:
如題,都會留下一個(無法全部最小化,只有一個的時候又正常),問題出在那裡?如何修改?
for (int i=0;i < MDIChildCount;i )
{
MDIChildren[i]->WindowState = wsMinimized;
}
ps.測試環境:WIN2K SP4 BCB6 UPDATE4 ◎天長地久有時盡,追求知識無絕期!
|
ENIX007
高階會員
發表:28 回覆:274 積分:185 註冊:2003-11-27
發送簡訊給我
|
g6101您好
小弟這樣做並沒有問題耶,請問您的做法是..
< class="code"> __fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
MDIChildCount = 0;
}
//--------------------------------------------------------------------------- void __fastcall TForm1::Button1Click(TObject *Sender)
{
MDIChildren[MDIChildCount] = new TForm(Application);
MDIChildren[MDIChildCount]->FormStyle = fsMDIChild;
MDIChildren[MDIChildCount]->Caption = "MDI" IntToStr(MDIChildCount);
MDIChildCount ;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
for (int i=0 ; i WindowState = wsMinimized;
}
}
//--------------------------------------------------------------------------- 程式迷人之處,在於邏輯思考,然而卻也是惱人之處~~
------ 程式迷人之處,在於邏輯思考,然而卻也是惱人之處~~
|
g6101
高階會員
發表:22 回覆:129 積分:110 註冊:2002-06-15
發送簡訊給我
|
您好:
我是參考BCB所提供(C:\Program Files\Borland\CBuilder6\Examples\Doc\TextEdit\textedit.bpr)
專案做為測試對象,因為裡頭的(ArrangeIcons)功能不起作用,所以自己動手修改之後,就發現了這樣的問題? ◎天長地久有時盡,追求知識無絕期! 發表人 - g6101 於 2004/05/20 18:35:04
|
ENIX007
高階會員
發表:28 回覆:274 積分:185 註冊:2003-11-27
發送簡訊給我
|
g6101您好
不知這樣是否符合您的需要呢
class="code"> //----------------------------------------------------------------------------
//Borland C Builder
//Copyright (c) 1987, 1998 Borland International Inc. All Rights Reserved.
//----------------------------------------------------------------------------
//---------------------------------------------------------------------------
#ifndef MDIFrameH
#define MDIFrameH
//---------------------------------------------------------------------------
#include
#include
#include
#include <Forms.hpp>
#include
#include
//---------------------------------------------------------------------------
class TEditForm;
class TFrameForm : public TForm
{
__published: // IDE-managed Components
TMainMenu *MainMenu1;
TMenuItem *File1;
TMenuItem *New1;
TMenuItem *Open1;
TMenuItem *N1;
TMenuItem *Exit1;
TMenuItem *Window1;
TMenuItem *Tile1;
TMenuItem *Cascade1;
TMenuItem *Arrangeicons1;
TOpenDialog *OpenFileDialog;
TButton *Button1;
void __fastcall Exit1Click(TObject *Sender);
void __fastcall Tile1Click(TObject *Sender);
void __fastcall Cascade1Click(TObject *Sender);
void __fastcall Arrangeicons1Click(TObject *Sender);
void __fastcall New1Click(TObject *Sender);
void __fastcall Open1Click(TObject *Sender);
void __fastcall Button1Click(TObject *Sender);
private: // User declarations
int MDIChildCount;
TEditForm *MDIChildren[10];
public: // User declarations
virtual __fastcall TFrameForm(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern TFrameForm *FrameForm;
//---------------------------------------------------------------------------
#endif MDIFrame.cpp
//----------------------------------------------------------------------------
//Borland C Builder
//Copyright (c) 1987, 1998 Borland International Inc. All Rights Reserved.
//----------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include
#pragma hdrstop #include "MDIFrame.h"
#include "MDIEdit.h"
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
TFrameForm *FrameForm;
//---------------------------------------------------------------------------
__fastcall TFrameForm::TFrameForm(TComponent* Owner)
: TForm(Owner)
{
MDIChildCount = 0;
}
//---------------------------------------------------------------------------
void __fastcall TFrameForm::Exit1Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------
void __fastcall TFrameForm::Tile1Click(TObject *Sender)
{
Tile();
}
//---------------------------------------------------------------------
void __fastcall TFrameForm::Cascade1Click(TObject *Sender)
{
Cascade();
}
//---------------------------------------------------------------------
void __fastcall TFrameForm::Arrangeicons1Click(TObject *Sender)
{
ArrangeIcons();
}
//---------------------------------------------------------------------
void __fastcall TFrameForm::New1Click(TObject *Sender)
{
EditForm = new TEditForm(this);
MDIChildren[MDIChildCount] = EditForm;
MDIChildCount ;
}
//---------------------------------------------------------------------
void __fastcall TFrameForm::Open1Click(TObject *Sender)
{
if(OpenFileDialog->Execute()){
EditForm=new TEditForm(this);
EditForm->Open(OpenFileDialog->FileName);
}
}
//---------------------------------------------------------------------
void __fastcall TFrameForm::Button1Click(TObject *Sender)
{
for (int i=0 ; iWindowState = wsMinimized;
}
//--------------------------------------------------------------------------- 紅色部分是小弟增加的...我的環境是WIN2K,BCB5.0
另外,ArrangeIcons用法是排序已縮小化的Form喔,把Form都縮小後,任意移動他們
的位置後,再執行它,就可以看到效果喔 程式迷人之處,在於邏輯思考,然而卻也是惱人之處~~
------ 程式迷人之處,在於邏輯思考,然而卻也是惱人之處~~
|
g6101
高階會員
發表:22 回覆:129 積分:110 註冊:2002-06-15
發送簡訊給我
|
您好:
非常感謝,經你提醒才去查一下ArrangeIcons的用法,原來是我誤會了!
不過全部最小化,在我的機器跑起來一樣不行,後來改成
<>>>
這樣就可以了. ◎天長地久有時盡,追求知識無絕期!
|