PictureBox.BorderStyle Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Indicates the border style for the control.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

member BorderStyle : BorderStyle with get, set

Property Value

Type: System.Windows.Forms.BorderStyle

One of the BorderStyle enumeration values. The default is None.

Exception Condition
InvalidEnumArgumentException

The value assigned is not one of the BorderStyle values.

You can specify this property at design time or run time.

The following code example demonstrates the use of the PictureBox and ListView controls. The PictureBox is initialized by setting the BorderStyle and SizeMode properties using the BorderStyle and PictureBoxSizeMode enumerations, respectively. The ListView is populated with pictures from the Sample Pictures directory. The ListView.GetItemAt method is used in when handling the MouseDown event of the ListView control to determine whether an item is selected. If an item is selected, the event handler displays the selected file by setting the Image property. The example requires that you have JPG files located in the C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures directory. To run this example, paste the code into a form and call the InitializePictureBox and PopulateListView methods in the form's constructor or Load event-handling method. Ensure all events are associated with their event-handling methods.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: