|
메인폼 리싸이즈시에 Frame의 Parent인 Panel도 리사이즈 되도록 코딩을 해주어야 하나요? 전 따로 코딩한게 없는데.그냥 Panel을 alClient로 설정해놓고 따로 설정한건 없는데..
아래코드는 이현진님이 주신 코드를 사용했습니다. 따로 호출하는 부분은 없어서....
__fastcall TMainForm::TMainForm(TComponent* Owner)
: TForm(Owner)
{
InitializeMenu();
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::ApplicationEvents1Message(tagMSG &Msg, bool &Handled){
// if(Msg.message==WM_USER_INITIALIZE_MENU)
// {
// Handled=false;
// InitializeMenu();
// }
}
//------------------------------------------------------------------------------
void __fastcall TMainForm::InitializeMenu(void){
try
{
if(screen_list==NULL)
{
screen_list=new TComponentList;
screen_list->OwnsObjects=false;
} else
{
screen_list->Clear();
}
// 메뉴 목록에 폼 추가.
screen_list->Add(_Frame11);
screen_list->Add(_Frame21);
screen_list->Add(_Frame31);
// screen_list에 추가함.
for(int index=0; index<screen_list->Count; ++index)
{
TFrame* frame=dynamic_cast<TFrame*>(screen_list->Items[index]);
if(frame!=NULL)
{
// frame->Parent = Panel3;
frame->Width = CLIENT_WIDTH;
frame->Height = CLIENT_HEIGHT;
frame->Left=0;
frame->Top=0;
frame->Hide();
}
}
ShowMenu(2);
} catch(...) {}
}
//------------------------------------------------------------------------------
void __fastcall TMainForm::ShowMenuForm(TFrame* _frame){
if(_frame==NULL) return;
try
{
for(int index=0; index<screen_list->Count; ++index)
{
TFrame* frame=dynamic_cast<TFrame*>(screen_list->Items[index]);
if(frame!=NULL)
{
if(frame==_frame)
{
frame->BringToFront();
frame->Show();
} else
{
frame->Hide();
}
}
}
} catch(...) {}
}
//------------------------------------------------------------------------------
void __fastcall TMainForm::ShowMenu(int _index){
switch(_index)
{
case 2://frame1
ShowMenuForm(_Frame11);
break;
case 3://frame2
ShowMenuForm(_Frame21);
break;
case 4://frame3
ShowMenuForm(_Frame31);
break;
default:
break;
}
}
//------------------------------------------------------------------------------
void __fastcall TMainForm::FormCreate(TObject *Sender)
{
//메뉴 초기화 윈도우 메시지
// ::PostMessage(this->Handle,WM_USER_INITIALIZE_MENU,0,0);
MainForm->WindowState= wsMaximized;
}
}
//---------------------------------------------------------------------------
void __fastcall TMainForm::FormDestroy(TObject *Sender)
{
// list 삭제
try
{
if(screen_list!=NULL)
{
delete screen_list;
}
} catch(...) {}
}
공부맨 님이 쓰신 글 :
: 메인폼 리싸이즈시에 Frame의 Parent인 Panel도 리싸이즈되도록 작업해놓으셨다면, (Panel의 Align이 alClient든지...)
: Frame의 Align이 alClient일 경우 동작이 문제없이 되어야 할텐데 이상하군요.
: 간단하게나마 유사코드라도 볼 수 있을까요?
:
: 또아리 님이 쓰신 글 :
: : Frame의 align을 alClient로 설정하면 안되나요?
: :
: : 공부맨 님이 쓰신 글 :
: : : 또아리 님이 쓰신 글 :
: : : : 메인폼에서 일정부분(Panel) 에Frame을 번갈아서 표시하고 있는데요
: : : : 바로 밑에 질문을 했드랬습니다. 근데 메인폼은 autoscroll 기능이 먹는데 ....번갈아서 표시될 Frame에 AutoScroll을
: : : : true로 설정해도 autoscroll 기능이 먹질 않네요...왜 그런걸까요? 원래 Frame에 autoscroll을 설정하면 되어야 할거 같은데....좀 알려주세요 감사합니다
: : :
: : : 메인폼에 Frame을 표시할때 Frame의 사이즈를 메인폼상에 표시될 사이즈만큼 변경해 주시나요?
: : : 그렇지 않으면 화면상에는 메인폼 영역만큼만 보이겠지만 실제 Frame의 사이즈는 그렇지 않기 때문에 오토스크롤이 동작 안할 수 있습니다.
|