Share via


How to: Create a Windows Explorer–Style Interface on a Windows Form

Windows Explorer is a common user-interface choice for applications because of its ready familiarity.

Windows Explorer is, essentially, a TreeView control and a ListView control on separate panels. The panels are made resizable by a splitter. This arrangement of controls is very effective for displaying and browsing information.

The following steps show how to arrange controls in a Windows Explorer-like form. They do not show how to add the file-browsing functionality of the Windows Explorer application.

Note

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Working with Settings.

To create a Windows Explorer-style Windows Form

  1. Create a new Windows Application project. For details, see How to: Create a New Windows Forms Application Project.

  2. From the Toolbox:

    1. Drag a SplitContainer control onto your form.

    2. Drag a TreeView control into SplitterPanel1 (the panel of the SplitContainer control marked Panel1).

    3. Drag a ListView control into SplitterPanel2 (the panel of the SplitContainer control marked Panel2).

  3. Select all three controls by pressing the CTRL key and clicking them in turn. When you select the SplitContainer control, click the splitter bar, rather than the panels.

    Note

    Do not use the Select All command on the Edit menu. If you do so, the property needed in the next step will not appear in the Properties window.

  4. In the Properties window, set the Dock property to Fill.

  5. Press F5 to run the application.

    The form displays a two-part user interface, similar to that of the Windows Explorer.

    Note

    When you drag the splitter, the panels resize themselves.

See Also

Tasks

How to: Create a Multipane User Interface with Windows Forms

How to: Define Resize and Positioning Behavior in a Split Window

How to: Split a Window Horizontally

Reference

SplitContainer

Other Resources

SplitContainer Control (Windows Forms)