Making the Startup Form Invisible in Visual Studio .NET

Encoding QR Code ISO/IEC18004 in Visual Studio .NET Making the Startup Form Invisible

Making the Startup Form Invisible
Creating Quick Response Code In .NET Framework
Using Barcode generation for ASP.NET Control to generate, create QR-Code image in ASP.NET applications.
www.OnBarcode.com
Bar Code Maker In .NET Framework
Using Barcode creator for ASP.NET Control to generate, create barcode image in ASP.NET applications.
www.OnBarcode.com
At times you might want the startup form to be invisible at run time. For example, you might want a form to execute a time-consuming process when starting and not appear until that process is complete. The Visible property determines whether a form is vis ible at run time. You can set the Visible property either in the Property Grid or in code. If you set Visible to False in the property window, the form will be invisible at startup. To make a form invisible during execution, set the Visible property to False in code, as shown in the following example:
QR Code Generation In C#.NET
Using Barcode creation for .NET Control to generate, create QR image in Visual Studio .NET applications.
www.OnBarcode.com
Creating QR Code In VS .NET
Using Barcode drawer for Visual Studio .NET Control to generate, create QR Code image in .NET framework applications.
www.OnBarcode.com
' VB aForm.Visible = False // C# aForm.Visible = false;
Make QR Code JIS X 0510 In VB.NET
Using Barcode generator for Visual Studio .NET Control to generate, create QR image in Visual Studio .NET applications.
www.OnBarcode.com
Data Matrix Generation In .NET
Using Barcode encoder for ASP.NET Control to generate, create Data Matrix image in ASP.NET applications.
www.OnBarcode.com
Quick Check
Paint Matrix Barcode In Visual Studio .NET
Using Barcode generator for ASP.NET Control to generate, create Matrix 2D Barcode image in ASP.NET applications.
www.OnBarcode.com
UPC-A Supplement 5 Generator In Visual Studio .NET
Using Barcode generation for ASP.NET Control to generate, create UPC-A Supplement 2 image in ASP.NET applications.
www.OnBarcode.com
1. How can you specify the Startup Location of a Form 2. How do you set the Startup Form
Paint Quick Response Code In Visual Studio .NET
Using Barcode printer for ASP.NET Control to generate, create QR image in ASP.NET applications.
www.OnBarcode.com
Code 128 Code Set A Encoder In VS .NET
Using Barcode printer for ASP.NET Control to generate, create ANSI/AIM Code 128 image in ASP.NET applications.
www.OnBarcode.com
Quick Check Answers
Painting EAN 128 In Visual Studio .NET
Using Barcode creation for ASP.NET Control to generate, create EAN / UCC - 13 image in ASP.NET applications.
www.OnBarcode.com
Creating Interleaved 2 Of 5 In Visual Studio .NET
Using Barcode creator for ASP.NET Control to generate, create I-2/5 image in ASP.NET applications.
www.OnBarcode.com
1. Use the Form.StartPosition to indicate the starting position of a Form. 2. In Visual Basic, you can set the Startup form by setting the value in the Application tab of the project properties. In C# you must locate the Appli cation.Run method and change the startup form there.
UPC Symbol Generator In None
Using Barcode drawer for Software Control to generate, create UPCA image in Software applications.
www.OnBarcode.com
Printing European Article Number 13 In None
Using Barcode printer for Online Control to generate, create European Article Number 13 image in Online applications.
www.OnBarcode.com
1
Bar Code Scanner In VS .NET
Using Barcode Control SDK for ASP.NET Control to generate, create, read, scan barcode image in ASP.NET applications.
www.OnBarcode.com
Creating GTIN - 128 In None
Using Barcode generator for Online Control to generate, create UCC.EAN - 128 image in Online applications.
www.OnBarcode.com
Windows Forms and the User Interface
Creating Universal Product Code Version A In Objective-C
Using Barcode maker for iPad Control to generate, create Universal Product Code version A image in iPad applications.
www.OnBarcode.com
Code-39 Creator In Java
Using Barcode generator for Android Control to generate, create Code 3 of 9 image in Android applications.
www.OnBarcode.com
Creating Non-Rectangular Windows Forms
Recognizing Bar Code In None
Using Barcode recognizer for Software Control to read, scan read, scan image in Software applications.
www.OnBarcode.com
Scan Barcode In VS .NET
Using Barcode decoder for VS .NET Control to read, scan read, scan image in .NET framework applications.
www.OnBarcode.com
For advanced visual effects, you might want to create forms that are non-rectangular. For example, you might want to create an oval form or a form in the shape of your company s logo. Although creating a non-rectangular form is easy, there are several considerations for the final look and feel of the form. You can create a non-rectangular form by setting the Region property of the form in the Form_Load event handler. Because the change in shape of the form actually occurs at run time, you are unable to view the form in its actual shape at design time. Thus, you might have to start the application and view the form several times as you finetune the appearance and placement of controls. The Region property is an instance of System.Drawing.Region. This class represents an area of the screen that is the interior of a graphics shape defined by rectangles and graphics paths. The easiest way to create a non-rectagular region is to create a new instance of the GraphicsPath class, and then create the new Region from it. The follow ing code demonstrates a simple example.
' VB Dim myPath As New System.Drawing.Drawing2D.GraphicsPath ' This line of code adds an ellipse to the graphics path that inscribes the ' rectangle defined by the form's width and height myPath.AddEllipse(0, 0, Me.Width, Me.Height) ' Creates a new Region from the GraphicsPath Dim myRegion As New Region(myPath) ' Sets the form's Region property to the new region Me.Region = myRegion // C# System.Drawing.Drawing2D.GraphicsPath myPath = new System.Drawing.Drawing2D.GraphicsPath();
// This line of code adds an ellipse to the graphics path that inscribes
// the rectangle defined by the form's width and height
myPath.AddEllipse(0, 0, this.Width, this.Height);
// Creates a new Region from the GraphicsPath
Region myRegion = new Region(myPath);
// Sets the form's Region property to the new region
this.Region = myRegion;
The System.Drawing and System.Drawing.Drawing2D classes will be discussed in fur ther detail in 14, Creating Windows Forms Controls. Because non-rectagular forms will have limited borders (if any), it is generally a good idea to set the FormBorderStyle property of the form to None. This prevents any parts of the form that intersect the original rectangle edges of the form from having a dif ferent and unwanted appearance. However, with the FormBorderStyle property set to
Lesson 1: Adding and Configuring Windows Forms
None, there will be no way for the user to resize, move, or close the form, and you must build these features into your design. A simple non-rectangular form is shown in Figure 1-4.
Figure 1-4
An elliptical form with a Close Form button
To create a non-rectangular form
1. In the Property Grid, set the FormBorderStyle to None. 2. Double-click the form in the designer to open the default Form_Load event handler. 3. In the Form_Load event handler, create a new instance of the Region class as shown in the previous example. 4. If desired, add close, move, or resize functionality to the form because the user might not be able to access the form s borders or title bar. 5. Set the form as the startup form and press F5 to view the form. Fine-tune the appearance and placement of controls as necessary.
Copyright © OnBarcode.com . All rights reserved.