Article: FormBorderStyle

Home Page


Consultancy

  • Service Vouchers
  • Escrow Service

Shop



Programming
  • Articles
  • Tools
  • Links

Search

 

Contact

 

Chess Puzzles




DWHS

Valid XHTML 1.0 Transitional
Valid CSS!
Mobile-friendly!

An experiment showing different form border styles for a WinForms app.

category 'experiment', language C#, created 14-May-2010, version V1.1 (03-Aug-2010), by Luc Pattyn


License: The author hereby grants you a worldwide, non-exclusive license to use and redistribute the files and the source code in the article in any way you see fit, provided you keep the copyright notice in place; when code modifications are applied, the notice must reflect that. The author retains copyright to the article, you may not republish or otherwise make available the article, in whole or in part, without the prior written consent of the author.

Disclaimer: This work is provided “as is”, without any express or implied warranties or conditions or guarantees. You, the user, assume all risk in its use. In no event will the author be liable to you on any legal theory for any special, incidental, consequential, punitive or exemplary damages arising out of this license or the use of the work or otherwise.


This article shows a lot of different form border styles that are available in a WinForm application, using the System.Windows.Form class.

The program

The application is a simple C# program that offers a big form, on top of which 14 more little forms get created and shown. They use zeven different values for the FormBorderStyle property, and half of them have their title bar suppressed by disabling all title bar components (this requires ControlBox=false; MaximizeBox=false; MinimizeBox=false; Text="";).

The entire Visual Studio project is available here; it targets .NET 2.0

The result

Running on Vista or Windows7, the result is like so:

FormBorder1

Running on XP, the result is like so:

FormBorder1

Visual Styles

When an application is launched, one can enable "visual styles" which influences how some Controls get painted; this application contains the necessary logic to let the user choose. Each time the checkbox' checkstate is changed, the new state is saved in a text file, and the application is restarted by calling Application.Restart(); this can be noticed by watching the process ID which gets displayed in the main form's title bar. Apparently the "Visual Styles" don't influence the form's border on Vista.

History

  • Version 1.0 (14-May-2010): Original version
  • Version 1.1 (03-Aug-2010): XP and Windows7 results added


Perceler

Copyright © 2012, Luc Pattyn

Last Modified 02-Sep-2013