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 |
This article shows a lot of different form border styles that are available in a WinForm
application, using the System.Windows.Form
class.
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
Running on Vista or Windows7, the result is like so:
Running on XP, the result is like so:
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.
Perceler |
Copyright © 2012, Luc Pattyn |
Last Modified 20-Dec-2024 |