2012-04-03 3 views
1

내 양식이 탭 페이지 상단에 임베드되어 있습니다. 탭 페이지 상단에있는 양식을 닫을 때 어떻게 탭 페이지를 닫을 수 있습니까? 나는 tabpage에 내 양식을 넣어탭이 내장 된 상태에서 탭을 닫는 방법?

코드는 더 적은 이렇게 있습니다 :

client c = new client(car_name, owner); //here client is another winform class 
c.TopLevel = false; 
c.Visible = true; 
c.BackColor = Color.Ivory; 
c.FormBorderStyle = FormBorderStyle.None; 
c.Dock = DockStyle.Fill; 
tabControl1.TabPages[tab_index].Controls.Add(c); 
+1

WPF? 실버 라이트? 지하철? WinForms? –

+1

'FormBorderStyle'에서 WinForms를 추측 할 것입니다. – mydogisbox

+0

@qwrqwr'client'가 어떤 유형을 상속합니까? 'Form','UserControl' 또는'Control'? – surfen

답변

3

사용 FormClosing 이벤트 :

private void ClientForm_FormClosing(object sender, FormClosedEventArgs e) 
    { 
     ((TabControl)((TabPage)this.Parent).Parent).TabPages.Remove((TabPage)this.Parent); 
    } 
+0

매우 도움이, 내가 어떻게 그것을 그림으로 노력하고 지금은 자신에 의해 작동 ... –

+0

한 질문 더, 어떻게 tabpage 부모 Winform 닫힌 경우 알 수 있습니까? –

관련 문제