2012-12-19 93 views
-3

我有一個孩子的形式,加載在mdi parent.this子表單具有幻燈片效果,當其加載和來自屏幕的左側,並將設置在屏幕的中心(我用一個簡單的定時器做了這個)。滾動條不起作用的Mdi兒童滑動形式

的問題是,如果我不設置窗體的dockstylefill滾動條不工作,如果我設置dockstylefill,滑動效果無法正常工作和形式加載簡單!

這是在Form1的按鈕:

Timer timerPrevMonth = new Timer(); 
    //reserve_vaght_azar is the form that will be load in sliding effect 
    reserve_vaght_azar reservevaghtazar = null; 
    private void btn_prev_dey_Click(object sender,EventArgs e) 
    { 

     reservevaghtazar = new reserve_vaght_azar(); 
     reservevaghtazar.StartPosition = FormStartPosition.Manual; 
     reservevaghtazar.Location = new Point(this.Location.X-Width,Location.Y); 
     reservevaghtazar.MdiParent = MdiParent; 
     this.TopMost = true; 
     //here is dockstyle 
     // reservevaghtazar.Dock=DockStyle.Fill; 
     reservevaghtazar.Show(); 
     timerPrevMonth.Start(); 
    } 

這是定時器功能:

void timerPrevMonth_Tick(object sender,EventArgs e) 
    { 
     timerPrevMonth.Stop(); 
     reservevaghtazar.Location = new Point(reservevaghtazar.Location.X +15,this.Location.Y); 

     if (this.Location.X-reservevaghtazar.Location.X <5) 
     { 
      reservevaghtazar.Location = new Point(this.Location.X,this.Location.Y); 
      this.TopMost = false; 
      reservevaghtazar.BringToFront(); 
      reservevaghtazar.Focus(); 

     } 
     else 
      timerPrevMonth.Start(); 
    } 

當在Form1按下按鈕,表格reserve_vaght_azar將負載的滑動效果

+0

請張貼一些代碼重複的問題。 – LarsTech

+1

神祕的問題,表單沒有DockStyle屬性。你到底在說什麼? –

+0

請讓我把一些代碼告訴你 – Arash

回答

0

我解決了!

我簡單地加入reservevaghtazar.Dock=DockStyle.Fill;reservevaghtazar.Focus();

後的問題是,我被對接滑動形式之前的形式完全負載在screen.to我改變對接線的位置和它解決。

但它很奇怪,滾動條不工作,如果表格不填寫Mdi父母。