Practical Learning Logo

Creating a Border-Less, Title Bar-Less, Maximized Form

 

In some applications, you may want to have a window that occupies the whole desktop without a title bar or borders. You can this easily by changing the dimensions of the form when it comes up

  1. Start Microsoft Visual C++ .Net or MS Visual Studio .Net and create a new Windows Forms Application named WholeScreen
  2. Change the FormBorderStyle property to None
  3. Add a Button to the form. Change its properties as follows:
    Name: btnClose
    FlatStyle: Popup
    Caption: X
     
    Max Form
  4. Double-click the form
  5. Return to the form and double-click the X button
  6. Implement both events as follows:
     
    private: System::Void Form1_Load(System::Object *  sender, System::EventArgs *  e)
     {
    	 this->SetBounds(0, 0, Screen::GetBounds(this).Width, Screen::GetBounds(this).Height);
    
    	 this->btnClose->Left = Screen::GetBounds(this).Width - 22;
    	 this->btnClose->Top  = 0;
     }
    
    private: System::Void btnClose_Click(System::Object *  sender, System::EventArgs *  e)
     {
    	 Close();
     }
  7. Execute the application
  
 

Home Copyright © 2002-2005 FunctionX, Inc.