私はmdi親にロードする子フォームを持っています。この子フォームは、ロード時にスライド効果があり、画面の左側から来て、画面の中央に設定されます(これは単純なタイマーで行いました)。
問題はdockstyle
、フォームをfill
スクロールバーに設定しないと機能せず、設定dockstyle
するfill
とスライド効果が機能せず、フォームが単純に読み込まれることです。
これは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
がスライド効果でロードされます