예제 #1
0
 private void ExpendTimer_Tick(object sender, EventArgs e)
 {
     // Getting the current size and location
     CurrentW     = this.Size.Width;
     CurrentH     = this.Size.Height;
     CurrentFormX = this.Location.X;
     CurrentFormY = this.Location.Y;
     // Setting the location of the tabControl for the first time
     tabControl1.Location = new Point(-((FinalWShould - CurrentW) / 2 + 6), -((FinalHShould - CurrentH) / 2 + 25));
     // Resizing and setting the location of the form per one Timer Interval
     this.Size            = new Size(plusW(), plusH());
     this.Location        = new Point(LocationX(), LocationY());
     tabControl1.Location = new Point(-((FinalWShould - CurrentW) / 2 + 6), -((FinalHShould - CurrentH) / 2 + 25));
     if ((W == true) & (H == true))
     {
         ExpendTimer.Stop();
     }
 }
예제 #2
0
 private void Shrink()
 {
     // This part is about shrinking automaticlly the form
     // Get the size of the window before Shrinking and again Expanding
     FinalWShould = this.Size.Width;
     FinalHShould = this.Size.Height;
     FirstFormX   = this.Location.X;
     FirstFormY   = this.Location.Y;
     // Setup the boolens (this is for if you want to use it again)
     W = false;
     H = false;
     // Shrink and setup the location of the form
     this.Size     = new Size(ShrinkW(), ShrinkH());
     this.Location = new Point(FirstFormX + ((FinalWShould - ShrinkW()) / 2), FirstFormY + ((FinalHShould - ShrinkH()) / 2));
     // Setup the Timer Interval from the int TimerInterval and then start the Timer
     ExpendTimer.Interval = TimerInterval;
     ExpendTimer.Start();
 }