Border Handling Procedure in Windows Forms Programming

This article will address some of the problems of the Form Border in Windows Forms programming with C#. Some minor customization is needed to change the shape of the desired form. You may normally have less use of Form Border customization, but of course in some certain cases they are really useful.

1. Form Border

The Border attribute of type Form is divided into 6 and 1 is none (no border), but it is basically divided into two main types. In the picture below you can see 4 full forms above 3 buttons (minimize, maximize and close) and the 2 forms under the border of the tool box should only Close. The Fixed attribute value will not change the size form.

1 Form Illustration Toolbox

2. Form punch for

The meaning of this action is as follows: In the Form attribute when TransparecyKey is set to a certain color, the form of the point value will be the perforated color (transparent). The example below shos the TransparecyKey selected properties, the 2 red panes should be the same throughout. Example: At position 2 the red transparent panel can be seen below. Not only that, but also through the operation, assuming the icon below may also be selected.

Extending the problem: If we create one form with dimensions equal in size, as shown below and that may vary depending on size and location on the form. At the same time set the opacity + backgroundColor can be set appropriately so the form interface has beautiful color throughout.

3. Form No Border

As is known, to change the location, it is necessary to click on the Form Border, unless they do not have borders. To transfer the form in the absence of the Border just do ​it using a few simple steps as shown below. First locate the switch used to hold and dy. There may be a Control Panel or any. Next set an appropriate number of events: MouseDown , MouseMove and MouseUp .

First determine where to hold and move the title bar instead of the border regime. In the following example set 1 position on the panel, you can easily select any other controls as an alternative such as panel, label, picture box.

Using two global variables: 1 is used to check the status view are a mouse click or not, one used to store the new coordinates when the mouse is clicked.

Establishing mouse_move event: 2 combination conditions (mouse_down + mouse_move) is the location update 2 global variables:

checkMouseDown: used to check the status of the mouse.

oldPoint: used to store the initial position of the mouse when the mouseDown event began.

For example: Click on the blue panel and switch Form dy

From My Site:

Up Next
    Ebook Download
    View all
    View all