2011年4月7日 星期四

2011.04.07[BCB][Form的切換


旋風管家{ハヤテのごとく}:桂 雛菊(桂 ヒナギク(かつら ひなぎく)
『毫無反應,就只是換衣』
以下正文:
//include 段將"Unit2.h" include
#include "Unit1.h"
#include "Unit2.h"
//將主Form1隱藏
__fastcall TForm1::TForm1(TComponent* Owner)
       : TForm(Owner)
{
   Application->ShowMainForm=false;
   //Form2->Show(); //頁面一顯示
   //Form1->Hide(); //頁面二隱藏
   //Form2->ShowModal(); //直到Form2關閉才能切回Form1
}
//頁面2顯示
__fastcall TForm2::TForm2(TComponent* Owner)
       : TForm(Owner)
{

   Form2->Show(); //頁面2顯示

}
void __fastcall TForm2::Button1Click(TObject *Sender)
{
   Form2->Hide(); //頁面二隱藏
   Form1->Show(); //頁面一顯示
   //Form2->Visible=False;
   //Form1->Visible=True;
}
//---------------------------------------------------------------------------
void __fastcall TForm2::Button2Click(TObject *Sender)
{
   Form2->Hide(); //頁面二隱藏
   Form1->Show(); //頁面一顯示
}
選擇完後,才切換到主要的Form1
是很醜的棋盤,最後再來修飾吧。


參考網頁:
程式一開始就隱藏Form / C++ Builder / 程式設計俱樂部
http://www.programmer-club.com.tw/showSameTitleN/cb/8212.html
關於不同的Form之間切換的問題 / C++ Builder / 程式設計俱樂部
http://goo.gl/c1GRB

沒有留言 :