Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[C#] Fullscreen

Junior Spellweaver
Joined
Nov 26, 2008
Messages
196
Reaction score
62
This was requested by a friend, so I thought I'd post it here.


Here is just a simple method for an application to enter to a full screen mode without writing a lot of resizing code in the main application.

Code:
private void Form1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
  {
   if ( e.KeyData == Keys.F11)
   {
      if (_bFullScreenMode == false)
      {
           Form2 f = new Form2();
           this.Owner = f;
           this.FormBorderStyle = FormBorderStyle.None;
           this.Left = (Screen.PrimaryScreen.Bounds.Width/2 - this.Width/2);
           this.Top = (Screen.PrimaryScreen.Bounds.Height/2 - this.Height/2);
           f.Show();
           _bFullScreenMode = true;
           f.KeyUp +=new KeyEventHandler(Form1_KeyUp);
      }
      else
      {
           Form f = this.Owner;
           this.Owner = null;
           f.Close();
     
           this.FormBorderStyle = FormBorderStyle.Sizable;
           _bFullScreenMode = false;
      }
   }
  }
 

Attachments

You must be registered for see attachments list
Last edited:
WowIwasSuperCringeB4
Loyal Member
Joined
Jun 21, 2008
Messages
1,297
Reaction score
226
There's a better way of doing this with much less code, but good job I guess.
 
Praise the Sun!
Loyal Member
Joined
Dec 4, 2007
Messages
2,502
Reaction score
986


Credits would be awesome.

P.S.

Code:
        private void Form1_KeyUp(object sender, KeyEventArgs e)
        {
            if (this.WindowState == FormWindowState.Normal)
            {
                this.WindowState = FormWindowState.Maximized;
                return;
            }

            this.WindowState = FormWindowState.Normal;
        }
 
WowIwasSuperCringeB4
Loyal Member
Joined
Jun 21, 2008
Messages
1,297
Reaction score
226
Exiled Hero just got owned by Wizkid.
 
Back
Top