O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Create a Form That Can’t Be Moved

Problem

You want to create a form that occupies a fixed location on the screen and cannot be moved.

Solution

Make a borderless form by setting FormBorderStyle to None.

Discussion

You can create a borderless form by setting the FormBorderStyle property to None. Borderless forms cannot be moved. However, they also lack any kind of border—if you want the customary blue border, you’ll need to add it yourself either with manual drawing code or by using a background image.

There is one other approach to creating an immovable form that provides a basic control-style border. First, set the ControlBox, MinimizeBox, and MaximizeBox properties to False. Then, set the Text property to an empty string. The form will have a raised ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required