The NetXP Component Suite

Introduction

Dacris NetXP is a component suite for .NET that developers can use to enhance the way their applications interact with the user. NetXP provides a library of rich user interface controls and components.

Make sure you read the license agreement before you start using NetXP.

Product Showcase

NetXP consists of the following:

  • Components and extender providers
  • Command bars, list bar, and status bar
  • Various Windows Forms controls
  • Docking manager and related controls
  • Task pane control suite
  • Reusable forms
  • Utility library and wrappers
  • Other components

For more information on the individual components, browse to the Tutorials section of the NetXP help file.

What's New

Here's what's new in version 3.0, compared to version 2.0:

  • Replaced old rebar wrapper with scratch-made command bar dock control.
  • Redesigned renderer framework.
  • Improved popup menus.
  • Command bars now have full MDI support.
  • Command bars can save/load layout.
  • Command bars are now breakable (multi-line) for menus and full-row bars.
  • Command bars support combo box and label items, and control container items.
  • Command bars provide customizable padding.
  • Support for changing color tables for Office-style renderers.
  • Support Tag property for command bar items and graph items.
  • Support for showing status bar messages from command bar items.
  • Support resizing of auto-hidden dock windows when they pop up.
  • Support for MDI tabbed groups.
  • New scratch-made status bar with progress bar panels.
  • New List Bar control, also known as Outlook Bar.
  • New Outlook-style Desktop Alert form.
  • New Drop-down tree view control.
  • New reusable popup form.
  • Tab control allows enable/disable drag-drop reordering of pages.
  • Task Pane allows setting custom colors.

Requirements

NetXP 3.0 requires Microsoft Visual Studio .NET 2003. It no longer supports VS.NET 2002. It technically supports all Windows operating systems on which .NET is supported. However, there may be certain problems with Windows 98 and Me which arise due to the architecture of these operating systems.

Installation and Usage

To add NetXP to your toolbox, follow these steps:

  • Open Visual Studio .NET 2003.
  • Right-click the toolbox and choose Add/Remove Items....
  • In the dialog box that comes up, click Browse.
  • Browse for the appropriate NetXP assembly and click OK.

To learn how to use NetXP, refer to the Tutorials section of the NetXP help file.


License Agreement

NETXP LICENSE
-------------

NetXP is free for personal use, but it is not free for use in commercial applications.
To use NetXP legally in a commercial application you must purchase a license from Dacris Software.

You may use NetXP in your applications, subject to the following terms:
- You may not attempt to decompile or disassemble the NetXP binaries.
- You may not modify the binaries in any way.
- You may distribute NetXP freely, provided that you include everything
  in this package, especially this license agreement.
- You may not distribute modified versions of the NetXP package.
- You may not resell, rent, or lease copies of NetXP to others.

You must agree to these terms in order to use NetXP.


FAQ

Frequently Asked Questions

This section addresses some of the most frequent questions asked by users of NetXP.

Q: Are upgrades free after purchasing NetXP, or if not, is there a discount?
A: When a newer version of NetXP is released, it will be offered to existing customers at a 30-50% discount compared to the full version.

Q: Is NetXP compatible with COM/VB6/Office applications?
A: No.

Q: Can I run a NetXP-based application in a reduced security context?
A: No, because NetXP uses extensive Win32 API calls.

Q: Are the XML files in the Assembly folder necessary or can these be disabled when you deploy solutions?
A: You do not have to include them in your deployment solutions. They are used simply for providing IntelliSense data in Visual Studio.

Q: Is there design-time support for the CommandBarDock control in VS.NET as a standalone control?
A: No, you cannot add a CommandBarDock manually. You can only add a CommandBarManager which adds a CommandBarDock to each edge of the form, or a standalone CommandBar.

Q: How do I dock two controls so that they are both on one side of my form and they both have their own docking window? I don't want them to be tabbed.
A: Set the TabbedMode property of the docked controls to False.

Q: When adding a button to a command bar, is there a way to set the index of the button so that you can place it in certain slots instead of just adding it to the end of the toolbar?
A: Yes. You can do this by calling the Insert method of the CommmandBarItemCollection as opposed to the Add method.

Q: When I use the SkinnedPanel with the silver color scheme of Windows XP's visual style, the background is not displayed correctly. What's going on?
A: This problem is due to the way Windows XP's Luna skin was made. Apparently the Silver color scheme has a very low-quality (grainy) tab page background bitmap. We still haven't figured out how Windows XP itself gets around this problem.


Component Suite

NetXP Component Suite

Computer Browser Form

This form facilitates the common task of browsing for computers on the local area network.

Example

Flags Editor

This type editor provides property grid editing support for flag enumerations. When used with an enumeration having the Flags attribute, this editor allows the user to select (using checkmarks) the flags to apply.

Example

Image Store

This ingenious component acts as a store for an image file. You can add it to your form or control and store an image resource inside it (which will be saved into the RESX), rather than having to embed that image file into your project file. This is also useful if you don't wish to use an image list. An image list will not preserve alpha-channel transparency, whereas this component will preserve the exact bits of the image you specify.

Extended Notify Icon

This component provides enhanced notify icon functionality not available in the standard Windows Forms NotifyIcon component. For instance, it allows you to display balloon tips from the system tray.

Example

MSN-Style Taskbar Notifier

This component allows you to display MSN-style skinned popup notifications.

Example

High Resolution Timer

This class provides some methods for high-resolution timing using performance counters.

Menu Item Image Extender

This component extends all Windows Forms menu items, adding an Image property. This allows you to assign an image to any standard menu item, by simply adding this component to your form.

Example

Status Message Extender

This extender allows you to specify messages for command bar items, at design time, to be shown on a status bar control when the command bar item is selected at runtime.


Bars Suite

NetXP Bars Suite

Command Bars and Context Menus

The command bar suite in NetXP is one of the most important aspects of NetXP. They enable a complete unification of menus and toolbars and provide an excellent user interface virtually identical to the one found in many Microsoft applications, including Office 2003.

The context menu is designed to replace the Windows Forms context menu and provide a way to display popup menus using the same architecture used by the command bar control.

List Bar

This control is an implementation of the Microsoft Outlook bar control. This control provides both the functionality of a standard Outlook bar control as well as the functionality of the VS.NET toolbox control. The List Bar control supports drag and drop, as well as custom rendering.

Status Bar

The NetXP status bar is a Windows Forms status bar that supports custom rendering and progress bar panels, as shown in the screenshots.

Renderer Support

Through custom extensible rendering, the NetXP bars support Office 2003, Office XP, and Windows XP visual styles. Because renderers are extensible, you can also define your own custom look and feel in your own applications.

The three screenshots on the right show the three renderers provided with NetXP. From top to bottom, these are: Office 2003, Office XP, and Windows Default.


Controls Suite

NetXP Controls Suite

Auto-Complete Text Box

This control is basically a text box with auto-complete (MRU) support.

Example

Balloon Tips

This type of balloon tip, unlike the one shown by notify icons, is not shown in the system tray. You can specify any parent control for the balloon tip, and the tip will be anchored to that control.

Example

Color Picker Button

This control is a button that shows a color in the center, with a drop-down arrow. It invokes a color picker form when it is clicked.

Example

Extended Combo Box

This control extends a combo box, mainly adding support for images and reading history items. You can also show all the history and recent documents in this combo box.

Example

Desktop Alert

This form is similar to the notification that Outlook shows when you receive a new email message. This form can be used to notify the user of a new email message.

Example

Drop-Down Tree View

The drop-down tree view control is essentially a combo box whose drop-down control is not a list box but a tree view.

Example

Graph

This control is a highly versatile graph control supporting bar graphs, line graphs, and pie charts, all in the same control. You can configure the graph and its items through various properties. Furthermore, you can save the graph at any time as a bitmap. You can save in any image format supported by GDI+.

Examples

Bar Graph

Line Graph

Pie Chart

Masked Text Box

The masked text box control enhances the functionality of the standard Text Box control by supporting a mask for validating user input. This control supports masks for date, IP address, SSN, phone number, digits, and decimals. It performs the validation, and automatically sets the delimiters to the appropriate locations.

Example

Skinned Panel

This panel control draws the background for a tab page under Windows XP (when the current application is skinned).

Example

XP Style Button

This control offers several enhancements to the standard Windows Forms button control. First of all, it uses System flat style by default, which means it's always skinned, provided that the application has a manifest. It also supports images, with System flat style, which is not possible with the standard Button control. Finally, as an added eye-candy effect, the button gradually fades between normal and hover states, with minimal CPU usage.

Example


Docking Suite

NetXP Docking Suite

Docking Manager

The NetXP docking manager provides support for VS.NET-style docking windows. It supports loading and saving layouts, tabbed dock windows, and custom renderers.

Example

MDI Tabbed Groups

You may have noticed that instead of using SDI or MDI, VS.NET uses a tabbed MDI interface. This interface shows a tab page for every open document. It also allows the creation of additional groups, both vertically and horizontally. The TabbedGroups control in NetXP allows you to recreate this interface in your own applications.

Example

Tab Control

The NetXP tab control is designed for use with the NetXP docking and tabbed groups, but can also be used as a stand-alone control. It has full design-time support as well as custom rendering support, utilizing the NetXP docking renderers.

For an example of the tab control, see the above screenshots.


Task Pane Suite

NetXP Task Pane Suite

Also known as explorer bars, task panes help the user perform common tasks with little effort. Task panes are part of the Windows XP user interface, found in applications such as Windows Explorer.

The NetXP task pane suite provides this functionality for .NET applications. It supports both default Windows colors and custom colors.

Example

Default Colors

 Custom Colors


Forms Suite

NetXP Reusable Forms

The inheritable forms in NetXP are provided so that your applications can have a common look and feel.

About Box

This form provides, among other things, a list of loaded assemblies.

Example

Dialog Box

This form is set up so that it has a fixed dialog border and no minimize or maximize buttons. It is also shown centered and it is not shown in the task bar. This form contains an OK button and a Cancel button, which are fully customizable and are set as the AcceptButton and CancelButton properties respectively.

Popup Form

This form provides an inheritable, reusable popup form that implements all the functionality of a typical popup window.

Example

Wizard Form

The wizard form provides all the functionality necessary to create a wizard.

Example


Library

NetXP Utility Library

Collection With Events

Can be used to create or derive a collection with events. Normal collections in .NET do not supply any events indicating when their contents have changed. This class raises various events when its items change.

FTP Library

Allows you to connect to FTP servers, providing the functionality of a simple FTP client, such as listing files, plus downloading and uploading files.

MAPI Library

Allows you to send and receive email messages from your applications, using MAPI.

UXTheme Wrapper

Allows you to use the Windows XP theme APIs to draw themed controls.

WNet Wrapper

The WNet wrapper can be used to enumerate all the computers on a network with a single function call.

Miscellaneous Utility Classes

Offers some useful miscellaneous utility methods, some of which can be used to get around known bugs in .NET.


Other

Miscellaneous NetXP Components

The .NET Application Loader

Loader.exe is a Win32 application that can load a .NET application after checking for the existence of the .NET Framework (specifically, MSCOREE.DLL). If MSCOREE.DLL is not found, the loader points the user to the Microsoft .NET Framework home page where they can download the .NET Framework.

The point behind all this is the avoidance of the "MSCOREE.DLL not found" error message when a user tries to execute a .NET application without the .NET Framework installed. The error message above is replaced with a much friendlier message, telling the user that they don't have the .NET Framework.

The Win32 Wrapper

NetXP has one of the world's most comprehensive Win32 wrappers for .NET. It contains the declarations of some 1600 API functions. Using the pre-declared APIs in the NetXP Win32 wrapper is not only easier but also less error-prone. All of the APIs declared in the Win32 wrapper are guaranteed to be error-free.


Menu Item Image Extender

The Menu Item Image Extender

Introduction

This component extends all Windows Forms menu items, adding an Image property. This allows you to assign an image to any standard menu item, by simply adding this component to your form.

Usage

Using the MenuImageExtender is easy. Follow these steps.

  • Add a regular Windows Forms menu (such as MainMenu or ContextMenu) to your form, using the toolbox.
  • Add a MenuImageExtender to the same form. It will be added to the component tray.
  • Select one of your menu items and you will see a new property called Image. Set this property to assign an image to the menu item.

The image won't be shown at design time. When you run your application, the items will be owner drawn using the images you specified.

Notes

This extender only provides image support for menu items. It does not change the way the items are rendered. You should not expect this extender to draw the menu items using Office XP or Office 2003 style. For that, please see the CommandContextMenu class.


Status Message Extender

The Status Message Extender

Introduction

This extender allows you to specify status bar messages for your CommandBar items, to be shown on a NetXP StatusBar control when the command bar item is selected.

Usage

To use this extender, add it to your form using the toolbox. It will be added to the component tray. Next, specify the control you would like to use as your status bar. You can only specify a NetXP StatusBar control or another control that implements the NETXP.Library.IStatusMessageAcceptor interface. Finally, select a command bar item and set the StatusMessage property to configure its status message.

Notes

At runtime, the status message for a particular command bar item will be shown when the user hovers over the item, either with the mouse or selecting it from a menu using the keyboard. All status bar panels are hidden when the status message is shown.


Computer Browser Form

The Computer Browser Dialog

Introduction

This dialog is meant to facilitate the common task of browsing for computers on the local area network.

The dialog looks like this:

Usage

To show this dialog, use the following code:

    NETXP.Components.CompBrowser dlg = new NETXP.Components.CompBrowser();
    dlg.ShowDialog(this);

To retrieve the selected computer name, use the SelectedComputer property.

Implementation

This dialog utilizes the Library.WNet class to enumerate network nodes.


Extended Notify Icon

Enhanced Notify Icon

Introduction

This component provides enhanced notify icon functionality not available in the standard Windows Forms NotifyIcon component. For instance, it allows you to display balloon tips from the system tray.

Usage

Use this component much like you would use its Windows Forms counterpart. To show a balloon tip, call the function ShowBalloon as shown in the code below.

    notifyIcon.ShowBalloon("Testing NotifyIconEx",
        "This is a balloon tip. This is impossible to do with the standard NotifyIcon.",
        NETXP.Components.NotifyInfoFlags.Info, 3000);

Where notifyIcon is the name of your NotifyIconEx object.

The above code would produce this result:

For more information on the parameters of the ShowBalloon function, look up the function in the NetXP Reference.


Flags Editor

The Flags Type Editor

Introduction

This type editor provides property grid editing support for flag enumerations. When used with an enumeration having the Flags attribute, this editor allows the user to select (using checkmarks) the flags to apply.

This editor will show a drop-down list like this:

Usage

To use this editor, simply apply it using the Editor attribute to the property that you wish to use this editor. See the example below.

    ///
    /// Gets or sets the auto complete flags
    ///
    [Category("Behavior")]
    [Description("The auto complete flags.")]
    [Editor(typeof(NETXP.Components.FlagsEditor), typeof(System.Drawing.Design.UITypeEditor))]
    public AutoCompleteFlags Flags
    {
        get
        {
            return flags;
        }
        set
        {
            flags = value;
        }
    }


High Resolution Timer

The High-Resolution Timer

Introduction

This class provides some methods for high-resolution timing using performance counters.

Usage

To use this class, first call XTimer.Init to initialize the timer. Next, call XTimer.Begin to begin timing and XTimer.End to end timing. When you call XTimer.End, the elapsed time (in microseconds) is returned.


Image Store

The Image Storage Component

Introduction

This ingenious component acts as a store for an image file. You can add it to your form or control and store an image resource inside it (which will be saved into the RESX), rather than having to embed that image file into your project file. This is also useful if you don't wish to use an image list. An image list will not preserve alpha-channel transparency, whereas this component will preserve the exact bits of the image you specify.

Usage

You should only need to use this component at design time. To add it at design time, drag & drop it from the toolbox into the designer. A new image store component should be created in the component tray. After adding the image store component, specify an image using the Image property. To retrieve the image later, just reference the Image property in your code.


Task Bar Notifier

The Taskbar Notification Component

Introduction

This component allows you to display MSN-style skinned popup notifications.

Usage

Using this component must be done from your code. The following code snippet shows how you can display a notification using your own custom background and button images.

    NETXP.Components.TaskbarNotifier tn;
    tn = new NETXP.Components.TaskbarNotifier();
    tn.NormalTitleColor = SystemColors.HotTrack;
    tn.NormalTitleFont = new Font(tn.NormalTitleFont, FontStyle.Bold);
    tn.NormalContentColor = SystemColors.WindowText;
    tn.HoverContentColor = SystemColors.HotTrack;
    tn.HoverTitleColor = SystemColors.ActiveCaption;
    tn.HoverTitleFont = tn.NormalTitleFont;
    tn.SetBackgroundBitmap(notifyBg.Image,Color.FromArgb(255,0,255));
    tn.SetCloseBitmap(notifyClose.Image,Color.FromArgb(255,0,255),new Point(127,8));
    tn.TitleRectangle = new Rectangle(60,12,100,30);
    tn.ContentRectangle = new Rectangle(8,43,133,64);
    tn.Show("Notification", "The XMark service has started.", 250, 1500, 250);

The above code uses two ImageStore components, notifyBg and notifyClose, to store the background image and close button image respectively. The sample produces this result:

The two bitmaps stored in the ImageStore components (notifyBg and notifyClose respectively) are:

and

The close button bitmap contains three states for the close button: normal, hover, and pressed.

The notification window's size will be the size of the background bitmap, so make your background bitmap a reasonable size. Also, the close button bitmap size doesn't matter, but it should follow this form: Width=ButtonSize*3, Height=ButtonSize, where ButtonSize is any pixel size.

For more details on the TaskbarNotifier, please refer to the NetXP reference documentation.


Command Bar Suite

The NetXP Command Bar Suite

Introduction

The command bar suite in NetXP is one of the most important aspects of NetXP. They enable a complete unification of menus and toolbars and provide an excellent user interface virtually identical to the one found in many Microsoft applications, including Office 2003. Through custom extensible rendering, the NetXP command bars support Office 2003, Office XP, and Windows XP visual styles. Because renderers are extensible, you can also define your own custom look and feel in your own applications.

Getting Started With Command Bars

Using command bars in your applications is designed to be as simple and straight-forward as possible. To create a simple command bar application, create a new Windows Forms application then follow the steps below.

  1. Add the NETXP.Controls.Bars.dll assembly to your toolbox if necessary.
  2. Drag and drop the CommandBarManager component onto your form.
  3. Select the command bar manager and click Add Command Bar in the properties window.
  4. The first command bar we will add should be a menu bar, so the next few steps will describe how to change the existing command bar to a menu bar.
  5. Select the top toolbar container on the form. This is called a CommandBarDock and it contains one or more command bars, managing their layout. There are four default CommandBarDock controls added to a form when the CommandBarManager object is added. These are docked to each of the four sides of the form and are necessary to provide full floating command bar support.
  6. Select the command bar inside the command bar dock. It should be called commandBar1.
  7. Go to the properties window and change the Style property to Menu. Notice how the command bar has changed to occupy the full row. Note: You should never add more than one menu bar to a form, since the menu bar hooks certain keyboard events, and if there is more than one menu bar, both bars might respond simultaneously to the same keyboard event.
  8. Next we need to add some menu items to the menu bar. At the bottom of the properties window you should see a few links. These are quick links for adding items to a command bar. Click the Add Button link. A new button item is created. A button item on a menu bar translates into a top-level menu item.
  9. In the properties window set the Text property of the item to "&File" (no quotes).
  10. Select the Items property and click the [...] button. This allows you to edit the collection of sub-items for this item. Editing the Items property is another way to view and edit command bar items.
  11. On the Add button you will notice a drop-down arrow. This means there are multiple types of items that can be added. Click the drop-down arrow and choose CommandBarButtonItem. A new CommandBarButtonItem is added. Set its Text property to "E&xit" (no quotes). Set its Shortcut property to AltF4. You can optionally also set an image to this item if you wish by changing the Image property.
  12. Click OK. The only menu item we will have for now is File -> Exit.
  13. Select the command bar manager again. Choose Add Command Bar.
  14. Select the newly-added command bar. This will be our toolbar.
  15. Click Add Button from the bottom of the property window.
  16. Specify an image property for the item by setting the Image property, or set the Text property to something and then set ShowText to True.
  17. You can add more items to the menu and toolbar if you wish, following the same procedures described above.
  18. Select the File -> Exit item by clicking the File menu item and then clicking the Exit item. Assign a Click event handler to the item. Inside the handler, close the form.

This simple tutorial has now taught you the basics of using the command bar suite in NetXP.

Using Command Bars With MDI Forms

To use command bars with MDI forms, you must assign your MDI client to the main menu bar, as the MdiContainer property. In the designer, select the main menu bar and select the MdiContainer property in the property grid. Open the drop-down list and choose your form object from the list. MDI support is now added to the menu bar. The MDI widgets will now be shown on the menu bar when an MDI child is opened.

Saving and Loading Layout

The command bars in NetXP 3.0 support saving and loading layouts.

To save the current layout, use the various overloads of CommandBarManager.SaveLayout. You can save the layout to a registry key, a binary stream, or an XML stream.

To load a layout, you can use the various overloads of CommandBarManager.LoadLayout. You can load the layout from a registry key, a binary stream, or an XML stream.

Stand-Alone Command Bars

You can use command bars as stand-alone controls. Instead of adding a command bar manager, add a command bar instead. The command bar will not be movable by the user nor will it have a size gripper. By default it will have the same background as its container, but you can specify another background color or image.

Showing and Hiding Command Bars

To show or hide a command bar, don't use the control's Show or Hide method, but rather the ShowBar and HideBar methods, respectively. These will show or hide a bar properly even if the bar is floating. Also, when a bar has been shown or hidden, a VisibleChanged notification is raised, which allows you to update any menu items to indicate whether or not the bar is showing.

Control Container Items

Not only are you allowed to have combo box items in a command bar, but you can add items that host any Windows Forms control. You can only add CommandBarControlItem objects to an item collection at runtime, since they're not supported in the designer. For example, to add a control item that hosts a Button control, refer to this code:

    CommandBarControlItem ctlItem = new CommandBarControlItem();
    this.commandBar2.Items.Add(ctlItem);
    ctlItem.Control = new Button();
    ctlItem.Control.Text = "Button Item";
    ctlItem.Width = 70;
    ctlItem.Height = 20;
    (ctlItem.Control as Button).FlatStyle = FlatStyle.System;

For more information on command bars, please see the NetXP reference documentation.


Command Context Menu

The NetXP Popup Menu

Introduction

This component is designed to replace the Windows Forms context menu and provide a way to display popup menus using the same architecture used by the command bar control. The CommandContextMenu contains a collection of CommandBarItems similar to the CommandBar control. It also uses the same renderer type as the command bar.

Usage

To use the command context menu, you can drag & drop it from the toolbox. Configure it using the property grid, by editing its Items collection as described in the tutorial for command bars. You can preview the menu in design mode by clicking Live Mode link.

To show a context menu, use the Show method. You should specify a control as the parent control for the menu, as well as the point (relative to the parent control) where the menu is to be shown. The Show method is synchronous which means it terminates only after the user has selected an item or dismissed the menu, much like the Windows Forms context menu.

Note: You should not use the command context menu with a system tray icon. This is because the menu was not designed to be used this way. Use a standard Windows Forms menu with tray icons.


The List Bar Control

Introduction

The list bar, also known as Outlook bar, is a control which is found in many Windows applications. Its appearance varies depending on the application, but generally it looks something like this:

Usage

The object model of this control is illustrated in the diagram below.

To create a simple application containing a list bar, create a new Windows Forms application then follow the steps below.

  1. Add the NETXP.Controls.Bars.dll assembly to your toolbox if necessary.
  2. Drag and drop the ListBar control to your form.
  3. Set the ListBar's dock style to Left.
  4. At the bottom of the property window you will see a link: Add Group. Click that link to add a new group to the list bar.
  5. The new group is now selected. Change its caption by setting the Caption property to "Outlook Shortcuts", without the quotes.
  6. For each group you can specify one of three display styles (for the items contained in that group): TextUnderneath, TextRight, and NoText. The first two correspond to the Outlook bar and VS.NET toolbox controls, respectively. Specify the TextUnderneath style for the View property.
  7. Edit this group's item collection by selecting the Items property and clicking the [...] button. Click Add to add a new item.
  8. Set the Caption of the item to "Outlook Today" (no quotes). Specify any 32x32 image for this item.
  9. Repeat step #8 for the Inbox item.
  10. Click OK to close the collection editor. Select the ListBar again, and click Add Group. Set the group's Caption property to "Other Shortcuts" without the quotes. Set its View property to TextRight.
  11. Add three new items to Other Shortcuts, each having its own caption and 16x16 image.
  12. Close the form designer and save the project.

This simple tutorial has now taught you the basics of using the list bar control in NetXP.

Handling Mouse Events

To handle mouse events per-item you should hook up to the control's MouseDown or MouseUp event, then inside the event handler use the ListBar's HitTest method with the given point to find the item under the mouse. The return value of HitTest is an IMouseHandler object, so you should convert it to a ListBarItem accordingly.


Office-Style Status Bar

The NetXP Status Bar

Introduction

The NetXP status bar is a Windows Forms status bar that supports custom rendering and progress bar items.

Usage

Use this status bar as you would use a normal Windows Forms status bar. The only difference is in adding the progress bar item. You cannot do this by editing the Panels collection at design time. You must add it by clicking the Add Progress Bar link at the bottom of the property window. However, after doing this, you can view the progress bar panel in the Panels collection and edit it like a regular panel.

To find out how to assign status bar messages to command bar items, see the information on the status message extender.


The Docking Suite

The NetXP Docking Suite

Introduction

The NetXP docking suite provides the following features:

  • Docking windows (described in this document)
  • Tabbed MDI groups
  • Enhanced tab control

The docking suite supports custom rendering.

Terminology

In order to use the docking suite effectively, certain key terms must be made clear.

  • Docking Manager Extender - This component extends the docking manager for design time support. There's nothing very exciting about it at runtime, other than its DockingManager property. To configure the layout more extensively, hook into the Loaded event and configure the dock objects contained by the docking manager there.
  • Docking Manager - This is the core component of the docking suite. It manages all dock objects. There should only be one docking manager per form.
  • Dock Object - A dock object is simply a control that has NetXP docking capabilities. That is, the user can see a title bar and border around the control, typically containing a close button. The user can drag the dock object around to other sides of the form, as well as make it float. A dock object is an abstraction of a window, containing only essential properties and events.
  • Window - A window is a ContainerControl, containing the dock frame and the actual docked controls (Control objects).
  • Dock Frame - The border and caption around a docked control.
  • Dock Region - A panel that contains multiple windows. Typically, there are four dock regions on a form, one for each side of the form.
  • Restore - A class that keeps track of all the serializable settings in the docking layout. There are multiple types of restores, for the different types of dock objects.

Usage

Tutorial

To create a simple application consisting of docked windows, create a new Windows Forms application then follow the steps below.

  1. Add NETXP.Controls.Docking.dll to your toolbox if necessary.
  2. Drag and drop the DockingManagerExtender to your form.
  3. Set the ContainerControl property to your form.
  4. Add a new tree view control to your form and dock it to the left.
  5. Set the tree view's AllowDocking property to True. This allows the docking manager extender to take over and make the tree view control into a dock object at runtime.
  6. Add a new list view control and dock it Fill. This will be the inner control, so set the docking manager extender's InnerControl property to the list view. Having an inner control allows you to create a form whose layout consists only of docking windows.

Now you've learned how to use the DockingManagerExtender to add docking window support to controls on your form.

The resulting application should look something like this:

At runtime, use the underlying DockingManager from the DockingManagerExtender to perform operations with the DockObjects or to change renderers.

Showing and Hiding Dock Objects

Use the following code to hide a docked window with the title "Settings":

    dockingManagerExtender1.DockingManager.HideDockObject(
        dockingManagerExtender1.DockingManager.DockObjects["Settings"]);

Conversely, you can use the ShowDockObject method to show a dock window.

Saving and Loading Layouts

To automatically save and load layout, you can set the AutomaticStatePersistence property of the docking manager extender to True. If you wish to load and save layout manually, use the DockingManager.SaveConfigTo... and DockingManager.LoadConfigFrom... methods.

More Information

For more information on DockingManagerExtender and DockingManager, refer to the NetXP reference documentation.


MDI Tabbed Groups

Tabbed MDI Groups

Introduction

You may have noticed that instead of using SDI or MDI, VS.NET uses a tabbed MDI interface. This interface shows a tab page for every open document. It also allows the creation of additional groups, both vertically and horizontally. The TabbedGroups control in NetXP allows you to recreate this interface in your own applications.

Terminology

When using the TabbedGroups control, you should be aware of what certain terms mean. Here they are described in more detail.

  • Sequence - A sequence contains multiple nodes. The TabbedGroups control only has one sequence, called the root sequence.
  • Node - A node can also be called a tabbed group. Nodes contain multiple tab pages and act as a way to group those tab pages. Each node has one tab control which handles the tab pages.
  • Tab Page - Every document in tabbed MDI is displayed as a tab page inside a tab control. In the case of tabbed groups, a tab page is usually contained within a node's tab control.

Usage

Adding Groups

The TabbedGroups control in NetXP 3.0 does not currently have design-time support. As a result, once you have added it to your form from the toolbox, you can only utilize it through code. You can set up the properties and events at design time, but you can't manage groups at design time.

To add a tabbed group to the TabbedGroups control, use the control's RootSequence property and call AddNewNode. This creates a new tabbed group. Then, to add tab pages to the group, use the group's TabPages property to add a new tab page to the group.

Example:

    TabGroupNode tn = this.tabbedGroups1.RootSequence.AddNewNode();
    tn.TabPages.Add(new NETXP.Controls.Docking.TabPage("Test 1"));
    tn.TabPages.Add(new NETXP.Controls.Docking.TabPage("Test 2"));
    tn = this.tabbedGroups1.RootSequence.AddNewNode();
    tn.TabPages.Add(new NETXP.Controls.Docking.TabPage("Test 3"));

The above example creates two vertical tabbed groups. The first group (on the left) shows two tab pages entitled Test 1 and Test 2. The second group (on the right) shows one tab page entitled Test 3.

The Active Node

The active node is the node which has the focus, or the last node which had the focus. There is always an active node as long as there is at least one tabbed group added to the TabbedGroups control. The TabbedGroups.ActiveNode property is used to find out which tabbed group is the currently active one and handle the ActiveNodeChanged event to be notified when the active node changes. This is useful when you must add a new tab page to the TabbedGroups control. In this case, you should add the new page to the active node rather than adding it to the first node in the sequence.

Saving and Loading Layout

To automatically save and load layout, you can use the TabbedGroups.SaveConfigTo... and TabbedGroups.LoadConfigFrom... methods, just like you do with the docking manager.


The Tab Control

The NetXP Tab Control

Introduction

The NetXP tab control is designed for use with the NetXP docking and tabbed groups, but can also be used as a stand-alone control. It has full design-time support as well as custom rendering support, utilizing the docking renderers.

Usage

Use this control much like you would use the Windows Forms default tab control. The properties and events are fairly self-explanatory.

Appearance

The appearance of the tab control can be modified by changing the TabPosition property. By setting this property to Top, you can use the tab control for tabbed MDI or as a regular tab control. If you set this property to Bottom, you will create a tab control similar to the one used by the NetXP docking windows.

Tab Pages

Tab pages derive from the Panel class, and therefore can be used to contain one or more controls. However, you may also assign another control to the TabPage's Control property which will be displayed when the tab page is selected. This can be useful when you don't know the control that will be displayed until runtime, or if you have to show a control that derives from Form or UserControl. The existence of the Control property is primarily due to the need for greater flexibility and enhanced code reuse. For example, if you have a form somewhere in your project that contains all the logic and controls you need for a certain part of your application, you can just instantiate that form and assign it to the Control property of a tab page and immediately have that form show up within the tab page.


The Task Pane Control

The NetXP Task Pane

Introduction

Also known as explorer bars, task panes help the user perform common tasks with little effort. Task panes are part of the Windows XP user interface, found in applications such as Windows Explorer.

The NetXP task pane suite is essentially comprised of three components:

  • The XPTaskPane control (a panel that contains multiple task pane groups)
  • The XPTaskPaneGroup control (a panel that can contain links for common tasks, or any other control)
  • The XPLink control (a hyperlink control that represents a common task within a task pane group). This control can be used as a stand-alone control.

The XPTaskPane Control

This control acts as a container for multiple task pane groups. The background of this control is drawn using a gradient, whose colors can be configured by setting the control's ColorTable property.

The XPTaskPaneGroup Control

This control acts as a container for multiple task pane links. It can also contain any other control. In a task pane, the groups are laid out one under the other. The XPTaskPaneGroup control handles all the layout behavior automatically. That is, if you collapse a group, all groups below it are moved up. Also, the controls inside the task pane group are moved up and out of view as the group is collapsed.

The XPLink Control

This control is a general-purpose hyperlink control supporting images and color tables. It integrates much better with the NetXP task pane than a regular Windows Forms link label control, but it can also be used as a standalone control. When you set an image with this control, the text is automatically moved out of the way of the image, unlike the standard link label control. Other than that, the XPLink control functions much like the LinkLabel control in Windows Forms.


Using Renderers

The Rendering Framework

Introduction

Some NetXP controls allow you to customize their appearance through the use of renderers. Most of these controls offer three renderers: Windows Default, Office XP, and Office 2003. The Office XP and Office 2003 renderers also provide a ColorTable property, which allows you to change the colors used by the renderer. For more information, see Color Tables. Below you can view some screenshots of the look and feel produced by each renderer.

Office 2003 Style:

Office XP Style:

Windows Default Style:

Usage

Assigning Renderers

Renderers can be assigned to NetXP controls using the control's Renderer property. By default, all controls use the Office 2003 look. The command bar manager also has a Renderer property which propagates to all the command bars assigned to the command bar manager. Below is an example of how you would change the renderer to Office XP, on the form shown in the screenshots above.

Implementing Custom Renderers

Several interfaces are provided to aid in the development of custom renderers. These are defined as I<Control Name>Renderer. In order to have a custom renderer, the class that you create must implement one of these interfaces. Please refer to the NetXP reference documentation for details on the renderer interfaces.


Standard Controls

Standard NetXP Controls

Introduction

This section provides a brief summary of each control in the NetXP Controls suite (found in NETXP.Controls.dll), containing miscellaneous controls.

AutoTextBox

This control is basically a text box with auto-complete (MRU) support. In reality, it is a combo box disguised as a text box. It stores frequently-used text entered by the user inside an XML file within isolated storage. The name of the XML file can be assigned using the AutoCompleteHeader property, which specifies the file name to use, excluding file extension.

The AutoTextBox control looks like this:

BalloonHelp

This form class allows you to display a balloon tip. It cannot be used at design time. After creating an instance of this class, set the Caption property to the title of the balloon and the Content property to the text you want to show in the balloon tip. The balloon tip, unlike the one shown by NotifyIconEx, is not shown in the system tray. You can specify any parent control for the balloon tip, and the tip will be anchored to that control. Use the ShowBalloon function to show a balloon tip using BalloonHelp.

The BalloonHelp form, when shown, looks like this:

ColorButton

This control is a button that shows a color in the center, with a drop-down arrow. It invokes a color picker form (ColorForm) when it is clicked. The last selected color is kept in the CenterColor property of this control.

The ColorButton control looks like this (with ColorForm also showing):

ComboBoxEx

This control extends a combo box, mainly adding support for images and reading history items. By setting the EnableMRU property to True, you can show all the history and recent documents in a combo box.

Set the Flags property to configure the auto-complete capabilities of the combo box. The combo box must be of the DropDown style to support auto-complete. Unlike the AutoTextBox, ComboBoxEx utilizes the system's auto-complete capabilities (from Win32), by using P-invoke.

To add image support to the items, set the ImageList property to an image list on your form, then assign image indices to the individual items.

DesktopAlert

This form is similar to the notification that Outlook shows when you receive a new email message. This form should only be used to notify the user of a new email message. To use this form, instantiate it in your code, specifying a message, a subject, and a sender. This information will be shown on the form. Then, simply set the form's position on screen, and call the Show method.

The form, when showed, should look something like this:

DropDownTreeView

The drop-down tree view control is essentially a combo box whose drop-down control is not a list box but a tree view. The underlying tree view can be accessed using the TreeView property, while the underlying text box can be accessed using the TextBox property.The text box contains the caption of the selected tree node. It is a read-only text box. To set the tree view's initial height, set the IdealTreeViewHeight property.

Graph

This control is a highly versatile graph control supporting bar graphs, line graphs, and pie charts, all in the same control. Use the GraphItems property of the Graph control to configure the bars, points, or pie slices shown on the graph. You can also configure the graph and its items through various properties. Furthermore, you can save the graph at any time as a bitmap by calling the SaveBitmap method. You can save in any image format supported by GDI+.

Sample Graph controls:

Bar Graph

Line Graph

Pie Chart

MaskedTextBox

The masked text box control enhances the functionality of the standard TextBox control by supporting a mask for validating user input. This control supports masks for date, IP address, SSN, phone number, digits, and decimals. It performs the validation, and automatically sets the delimiters to the appropriate locations. To apply a mask, use the Masked property. The control uses ErrorProvider to handle invalid input, by showing an exclamation icon next to the field when the user has entered invalid data.

MultiPage

This control is used primarily by the NetXP Wizard form. It is basically a tab control that does not show any tabs at runtime. It can be used for having multiple pages on a form but not allowing the user to navigate between them.

SkinnedPanel

This panel control draws the background for a tab page under Windows XP (when the current application is skinned). The controls inside it must be capable of supporting themed backgrounds. That is why you must use XPCheckBox and XPGroupBox inside this control rather than the their Windows Forms counterparts, since the NetXP variants support themed backgrounds while the Windows Forms controls do not.

The SkinnedPanel control looks like this when themed:

The above panel shown also contains an XPGroupBox and XPCheckBox control.

TreeViewEx

The only difference between TreeViewEx and the Windows Forms TreeView is in the way in which it handles checkboxes. TreeViewEx checks all child nodes when a parent node is checked, whereas the Windows Forms TreeView control only checks the parent node.

XPButton

The XPButton control offers several enhancements to the standard Windows Forms button control. First of all, it uses System flat style by default, which means it's always skinned, provided that the application has a manifest. It also supports images, with System flat style, which is not possible with the standard Button control. Finally, as an added eye-candy effect, the button gradually fades between normal and hover states, with minimal CPU usage.


Inheritable Forms

Introduction

The inheritable forms in NetXP are provided so that your applications can have a common look and feel. There are several such forms provided in NetXP, listed below:

  • About - An inheritable about box, providing information about your application.
  • Dialog - An inheritable dialog box, providing OK and Cancel buttons.
  • PopupForm - A special type of form that can be shown as a popup window. It does not deactivate its parent when shown, and it can have a drop shadow.
  • Wizard - An inheritable wizard dialog, with a MultiPage control that contains all the wizard pages.

Usage

Like any inheritable form in NetXP, you have to create a new Inherited Form in your project, and browse for the NETXP.Forms.dll. From the list of forms in that DLL, choose About and click OK. A new form will be created which inherits from the NetXP about box. Below are some screenshots illustrating these steps.

Select Add Inherited Form....

Click Browse....

Select NETXP.Forms.dll and click Open.

Select the form you wish to inherit.

Forms Provided with NetXP

About Box

This form provides, among other things, a list of loaded assemblies. The code for populating this list is given below.

    foreach (System.Reflection.Assembly s in AppDomain.CurrentDomain.GetAssemblies())
    {
        string[] lvsi = new string[3];
        lvsi[0] = s.GetName().Name;
        lvsi[1] = s.GetName().FullName;
        lvsi[2] = s.GetName().Version.ToString();
        System.Windows.Forms.ListViewItem lvi = new ListViewItem(lvsi, 0);
        this.ListOfAssemblies.Items.Add(lvi);
    }

Dialog Box

This form is set up so that it has a fixed dialog border and no minimize or maximize buttons. It is also shown centered and it is not shown in the task bar. This form contains an OK button and a Cancel button, which are fully customizable and are set as the AcceptButton and CancelButton properties respectively.

Popup Form

This form provides an inheritable, reusable popup form that implements all the functionality of a typical popup window. Important: Call the ShowPopup function instead of the Show function to display a popup form.

Wizard Form

The wizard form provides all the functionality necessary to create a wizard.

You may wish to create your own customized wizard without inheriting from NetXP's Wizard form. To do so, you should use the NetXP MultiPage control to store your wizard pages, and name it WizardPages. You should have Back, Next/Finish, and Cancel buttons. These should be called BackButton, NextButton, and CancelBtn, respectively. You should start out with the Back button disabled, and all other buttons enabled.

When Next is clicked, you should execute this code:

    if(this.WizardPages.SelectedIndex < this.WizardPages.TabCount-1)
    {
        this.WizardPages.SelectedIndex++;
    }
    else
    {
        this.DialogResult = DialogResult.OK;
        this.Close();
    }
    if(this.WizardPages.SelectedIndex >= 1)
    {
        this.BackButton.Enabled = true;
    }
    if(this.WizardPages.SelectedIndex == this.WizardPages.TabCount-1)
    {
        this.NextButton.Text = "Finish";
        this.NextButton.Focus();
    }

When Back is clicked, you should execute this code:

    if(this.WizardPages.SelectedIndex > 0)
    {
        this.WizardPages.SelectedIndex--;
    }
    if(this.WizardPages.SelectedIndex == 0)
    {
        this.BackButton.Enabled = false;
        this.BackButton.Refresh();
    }
    if(this.WizardPages.SelectedIndex == this.WizardPages.TabCount-2)
    {
        this.NextButton.Text = "Next >";
    }


Extended Collection Class

The CollectionEx Class

Introduction

This class can be used to create or derive a collection with events. Normal collections in .NET do not supply any events indicating when their contents have changed. The NetXP CollectionEx class raises various events when its items change.

Usage

This class can be inherited to create your own strongly-typed collection, much like you would inherit the .NET CollectionBase class. You can also use this class as-is, using it to store objects, like the ArrayList class.


Using Color Tables

NetXP Color Tables

Introduction

The color tables in NetXP are used by renderers such as the Office 2003 renderer and by task panes in order to determine what XP-style colors they should use based on the current Windows XP theme. A color table in NetXP basically consists of a publicly accessible collection of System.Drawing.Color instances. Color tables must implement the IColorTable interface defined in NETXP.Library.dll.

Predefined Color Tables

NetXP also provides built-in color tables for various XP themes. These can all be found in the NETXP.Library.ColorTables class, as static (shared) properties called Classic, Dynamic, XPBlue, XPOlive, and XPSilver. These are readily usable from your own programs.

The Classic color table specifies colors used either when the Windows Classic theme is being used, when the program is being run without theme support, or when a theme is being used that is recognized as neither XPBlue, XPOlive, nor XPSilver. The Classic color table is computed from the system colors each time its Colors collection is referenced. Thus, you should cache the Colors collection to avoid slowdowns.

The Dynamic color table specifies the colors that should used depending on the current Windows visual style. If the style is classic, not themed, or having a theme other than Luna, the Dynamic color table returns colors from the Classic color table. Otherwise, it returns the colors from either XPBlue, XPOlive, or XPSilver, depending on the currently selected theme. This is the best color table to use when you want your program to be fully color-agnostic.

The IColorTable Interface

When creating a custom color table, you have to declare a class that implements the IColorTable interface. This means it must contain a Colors property which is of the type ColorCollection. Within the get accessor, you should instantiate a new color collection and populate it with the necessary colors.

TableColor Enumeration

Each color, depending on its index, has a certain usage. This is mapped using the TableColor enumeration. Each index corresponds to an entry in the TableColor enumeration. You can use this enumeration to access a specific color within a color table.

Below are given the indices in the color collection to which each member in the TableColor enumeration corresponds:

0  TaskPaneStart
1  TaskPaneEnd
2  SystemTaskHeaderStart
3  SystemTaskHeaderEnd
4  SystemTaskHeaderTextNormal
5  SystemTaskHeaderTextHover
6  SystemTaskBoxFill
7  SystemTaskBoxBorder
8  SystemTaskButtonColor
9  NormalTaskHeaderStart
10 NormalTaskHeaderEnd
11 NormalTaskHeaderTextNormal
12 NormalTaskHeaderTextHover
13 NormalTaskBoxFill
14 NormalTaskBoxBorder
15 NormalTaskButtonColor
16 LinkColorNormal
17 LinkColorHover
18 RebarGradientStart
19 RebarGradientEnd
20 ToolbarGradientStart
21 ToolbarGradientEnd
22 ToolbarBottom
23 GripperDark
24 GripperLight
25 ToolbarButtonBorder
26 ToolbarButtonToggledGradientStart
27 ToolbarButtonToggledGradientEnd
28 ToolbarButtonPressedGradientStart
29 ToolbarButtonPressedGradientEnd
30 ToolbarButtonHoverGradientStart
31 ToolbarButtonHoverGradientEnd
32 PopupMenuBackground
33 PopupMenuBorder
34 MenuBarItemGradientStart
35 MenuBarItemGradientEnd
36 PopupMenuItemUncommonGradientStart
37 PopupMenuItemUncommonGradientEnd
38 PopupMenuItemCommonGradientStart
39 PopupMenuItemCommonGradientEnd
40 PopupMenuItemSelected
41 PopupMenuItemChecked
42 PopupMenuItemCheckedHover
43 Separator

Now, the color represented by each of the members, shown under Windows XP Luna (Blue) visual style:

Color Name | Usage Sample
TaskPaneStart |
TaskPaneEnd |
SystemTaskHeaderStart |
SystemTaskHeaderEnd | (See above)
SystemTaskHeaderTextNormal |
SystemTaskHeaderTextHover |
SystemTaskBoxFill |
SystemTaskBoxBorder |
SystemTaskButtonColor |
NormalTaskHeaderStart | See SystemTask... but for task pane groups of this type:
NormalTaskHeaderEnd | (See above note)
NormalTaskHeaderTextNormal | (See above note)
NormalTaskHeaderTextHover | (See above note)
NormalTaskBoxFill | (See above note)
NormalTaskBoxBorder | (See above note)
NormalTaskButtonColor | (See above note)
LinkColorNormal |
LinkColorHover | (See above)
RebarGradientStart |
RebarGradientEnd | (See above)
ToolbarGradientStart |
ToolbarGradientEnd | (See above)
ToolbarBottom | (See above)
GripperDark |
GripperLight | (See above)
ToolbarButtonBorder | (Border surrounding the above buttons)
ToolbarButtonToggledGradientStart | (See above diagram)
ToolbarButtonToggledGradientEnd | (See above diagram)
ToolbarButtonPressedGradientStart | (See above diagram)
ToolbarButtonPressedGradientEnd | (See above diagram)
ToolbarButtonHoverGradientStart | (See above diagram)
ToolbarButtonHoverGradientEnd | (See above diagram)
PopupMenuBackground |
PopupMenuBorder | (See above diagram)
MenuBarItemGradientStart |
MenuBarItemGradientEnd | (See above diagram)
PopupMenuItemUncommonGradientStart |
PopupMenuItemUncommonGradientEnd | (See above diagram)
PopupMenuItemCommonGradientStart | (See above diagram)
PopupMenuItemCommonGradientEnd | (See above diagram)
PopupMenuItemSelected | (See above diagram)
PopupMenuItemChecked | (See above diagram)
PopupMenuItemCheckedHover | (See above diagram)
Separator | (See above diagram)


FTP Library

The FTP Library

Introduction

This class allows you to connect to FTP servers, providing the functionality of a simple FTP client.

Usage

To use this library, instantiate the FTP class. Set the Remote... properties corresponding to the server to which you wish to connect. Then, call the Login method to connect to the server. To get a file list, call the GetFileList method and iterate through the returned string array. To disconnect, call the Close method.


Flexible Settings Class

The Settings Class

Introduction

This is a class that is used to save and restore data using the registry or by binary serialization in a file. It works in conjunction with another custom settings class that contains all the data to be stored.

Usage

You do not need to instantiate this class to use it. Use the static methods such as Read and Save to load and save settings respectively.

Refer to the NetXP reference documentation for more information on how to use this class.


Shadow Windows

Introduction

The ShadowWindow class provided by NetXP can be used to add custom-drawn drop shadows to any .NET control or form. This section provides some code snippets for using the ShadowWindow class correctly.

C#
// at the top of source code file:
using NETXP.Library;
using NETXP.Win32;

// inside custom control class:
private ShadowWindow shadowBottom = null;
private ShadowWindow shadowRight = null;

// inside the overridden OnHandleCreated method:
this.shadowRight = new ShadowWindow(Handle);
this.shadowBottom = new ShadowWindow(Handle);
this.shadowRight.ShadowType = ShadowType.Right;
this.shadowBottom.ShadowType = ShadowType.Bottom;

// handle PaintShadow for each shadow window
this.shadowRight.PaintShadow += new PaintEventHandler(OnPaintRightShadow);
this.shadowBottom.PaintShadow += new
        PaintEventHandler(OnPaintBottomShadow);

// show the shadow windows
shadowRight.Show();
shadowBottom.Show();

// inside the overridden OnHandleDestroyed method:
if(shadowRight != null)
{
shadowRight.Close();
shadowRight = null;
}
if(shadowBottom != null)
{
shadowBottom.Close();
shadowBottom = null;
}

// override WndProc and insert the following:
switch(m.Msg)
{
case API.WM_MOVING:
case API.WM_SIZING:
case API.WM_SIZE:
case API.WM_WINDOWPOSCHANGED:
API.RECT rc = new API.RECT();
API.GetWindowRect(Handle, ref rc);
if(shadowRight != null)
{
shadowRight.RenderShadow(rc.ToRectangle(), true);
}
if(shadowBottom != null)
{
shadowBottom.RenderShadow(rc.ToRectangle(), true);
}
base.WndProc(ref m);
break;
default:
base.WndProc(ref m);
break;
}

// event handlers:
private void OnPaintRightShadow(object sender, PaintEventArgs pe)
{
// TODO: Paint your right edge shadow here.
}
private void OnPaintBottomShadow(object sender, PaintEventArgs pe)
{
// TODO: Paint your bottom edge shadow here.
}

VB

        ' at the top of source code file:
Imports NETXP.Library
Imports NETXP.Win32

' inside custom control class:
Private ShadowBottom As ShadowWindow
Private ShadowRight As ShadowWindow

' inside the overridden OnHandleCreated method:
ShadowRight = New ShadowWindow(Handle)
ShadowBottom = New ShadowWindow(Handle)
ShadowRight.ShadowType = ShadowType.Right
ShadowBottom.ShadowType = ShadowType.Bottom

' handle PaintShadow for each shadow window
AddHandler ShadowRight.PaintShadow, AddressOf OnPaintRightShadow
AddHandler ShadowBottom.PaintShadow, AddressOf OnPaintBottomShadow

' show the shadow windows
ShadowRight.Show()
ShadowBottom.Show()

' inside the overridden OnHandleDestroyed method:
If Not ShadowRight Is Nothing Then
ShadowRight.Close()
ShadowRight = Nothing
End If
If Not ShadowBottom Is Nothing Then
ShadowBottom.Close()
ShadowBottom = Nothing
End If

' override WndProc and insert the following:
If m.Msg = API.WM_MOVING Or m.Msg = API.WM_SIZING Or m.Msg = API.WM_SIZE
        Or m.Msg = API.WM_WINDOWPOSCHANGED Then
Dim rc As New API.RECT()
API.GetWindowRect(Handle, rc)
If Not ShadowRight Is Nothing Then
ShadowRight.RenderShadow(rc.ToRectangle(), True)
End If
If Not ShadowBottom Is Nothing Then
ShadowBottom.RenderShadow(rc.ToRectangle(), True)
End If
End If
MyBase.WndProc(m)

' event handlers:
Private Sub OnPaintRightShadow(ByVal sender As Object, ByVal pe As
        PaintEventArgs)
' TODO: Paint your right edge shadow here.
End Sub
Private Sub OnPaintBottomShadow(ByVal sender As Object, ByVal pe As
        PaintEventArgs)
' TODO: Paint your bottom edge shadow here.
End Sub


The Utility Classes

The Utility Library

Introduction

The NetXP Utility class offers some useful miscellaneous utility methods, some of which can be used to get around known bugs in .NET. All properties and methods in this class are static (shared) and therefore accessible without instantiating the class.

The Methods

AddPNGToImageList - This handy little method adds any transparent image to an image list, preserving perfect alpha channel transparency.
BrowseForFolder - A quick and dirty function to display a Browse-For-Folder dialog.
Deserialize/Serialize [Isolated] - These functions can be used for quick XML serialization and deserialization.
FixPropertyGridsAndTreeViews - This utility function fixes property grids to persist the visible properties, and makes tree views' scrollbars skinable, fixing a few bugs found in the .NET Framework.
IsNull - A very neat function that verifies if a string/collection is null or empty, i.e. if it is null or its length is 0.
SetXPPasswordChar - This function can be used to set the XP-style password character '●' for text boxes, used instead of the standard asterisk character '*' on Windows XP.


WNet Wrapper

The WNet Wrapper

The WNet wrapper can be used to enumerate all the computers on a network. To do so, call the function WNet.EnumerateNetwork. It will execute, then return a WNetNodeCollection, which contains multiple levels of network nodes (WNetNode objects), much like tree view nodes.


.NET App Loader

The .NET Application Loader

Introduction

Loader.exe is a Win32 application that can load a .NET application after checking for the existence of the .NET Framework (specifically, MSCOREE.DLL). If MSCOREE.DLL is not found, the loader points the user to the Microsoft .NET Framework home page where they can download the .NET Framework.

The point behind all this is the avoidance of the "MSCOREE.DLL not found" error message when a user tries to execute a .NET application without the .NET Framework installed. The error message above is replaced with a much friendlier message, telling the user that they don't have the .NET Framework.

History

Back in the day, when Windows applications were written using the Windows API (and many still are), there was a little MS-DOS loader program embedded into the application at compile time, called the stub. This program would run when the application was run in MS-DOS mode, telling the user that they needed to run the application under Windows. It was much friendlier than allowing DOS to load the entire EXE and give an "invalid EXE file" error message, or "program too big to fit in memory".

The .NET Age

When the PE executable format was transferred over to .NET, the same thing happened with .NET executables. Windows is currently unable to load a .NET executable if the .NET Framework is not installed. It does exactly what DOS would do with a Windows executable if it didn't have a stub: it outputs a meaningless error message. However, this time Microsoft did not embed a stub in .NET executables. Thus, NetXP's Loader.exe was born. It acts as an external stub, providing a more meaningful error message to the user.

Using the Loader

The loader is easily configurable through the Loader.ini file. A sample Loader.ini file is provided with NetXP. You can configure whether or not you want to have a splash screen. The advantage of having the splash screen be shown by the loader is that the splash screen will be shown almost instantly, because the CLR doesn't have to be loaded (Loader.exe is a native Win32 application).

When specifying a splash screen image, you may only specify a BMP file, if you wish to be able to run the loader on Windows 98 and Me. Otherwise, you can specify JPG and GIF images as well. Along with the bitmap file, the splash screen can optionally show additional information, such as your application's version (taken directly from the executable), as well as copyright text. The text font and color can also be changed, as well as the location.

In the General section of the INI file, you must specify the file name of the .NET executable to load, and whether or not it requires the .NET Framework (sometimes you may wish to use the loader for other types of applications as well).

When launching your application, instead of launching the .NET executable, you must now launch Loader.exe.

Modifying the Loader

The loader can be customized even more by using a resource modification tool such as ResHacker. With such a tool, you can open up Loader.exe and change the version info inside it to match your application. You can also add an icon to it. This is all legally permitted, but only with Loader.exe.


Using The Win32 Wrapper

The Win32 Wrapper

Introduction

NetXP has one of the world's most comprehensive Win32 wrappers for .NET. This wrapper is found in the assembly called NETXP.Win32.dll. It contains the declarations of some 1600 API functions.

Usage

The NETXP.Win32.API class contains everything in the wrapper. Everything in the API class has the same name as its Win32 API correspondent. For example, to call CreateWindow, you would call NETXP.Win32.API.CreateWindow. All constants and structs are also declared in the API class.

Why Use It?

Why use the NetXP Win32 wrapper, rather than declare the APIs yourself, as you need them? The answer is simple: it's faster! Using the pre-declared APIs in the NetXP Win32 wrapper is not only easier but also less error-prone. All of the APIs declared in the Win32 wrapper are guaranteed to be error-free.