Open the ComInterop.cs file from the BandObjectLib project and add the following structure.

Listing 4 - DBIMF Structure 

/// <summary>
/// A set of flags that define the mode of operation for the band object.     
/// </summary>
[Flags]
public enum DBIMF : int
{
    //The band is normal in all respects. The other mode flags modify this flag.
    NORMAL = 0×0001,
    //Windows XP and later
    FIXED = 0×0002,
    FIXEDBMP = 0×0004,
    //The height of the band object can be changed. The ptIntegral member defines 
    //the step value by which the band object can be resized. 
    VARIABLEHEIGHT = 0×0008,
    //Windows XP and later:
    UNDELETEABLE = 0×0010,
    //The band object is displayed with a sunken appearance. 
    DEBOSSED = 0×0020,
    //The band will be displayed with the background color specified in crBkgnd. 
    BKCOLOR = 0×0040,
    //Windows XP and later:
    USECHEVRON = 0×0080,
    BREAK = 0×0100,
    ADDTOFRONT = 0×0200,
    TOPALIGN = 0×0400,
    NOGRIPPER = 0×0800,
    ALWAYSGRIPPER = 0×1000,
    NOMARGINS = 0×2000,
}Now you need to locate the DESKBANDINFO structure in the same file and change the type of its dwModeFlags data field from DBIM to the newly added structure type DBIMF. Also change the type of the dwMask field to DBIM. You should wind up with the following revised structure.

Listing 5 - DESKBANDINFO Structure 

[StructLayout(LayoutKind.Sequential,CharSet=CharSet.Unicode)]
public struct DESKBANDINFO
{
    public DBIM  dwMask;
    public Point ptMinSize;
    public Point ptMaxSize;
    public Point ptIntegral;
    public Point ptActual;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst=255)]
    public String    wszTitle;
    public DBIMF dwModeFlags;
    public Int32 crBkgnd;
};If you want to learn more then take a look on MSDN on how the DESKBANDINFO structure should be implemented. The last change you need to make is in the GetBandInfo(…) method of the BandObject class which is located in the BandObject.cs File. Assign the following value to the dwModeFlags field of the dbi structure in this method:

Listing 6 - GetBandInfo(…) method

public virtual void GetBandInfo(
    UInt32 dwBandID,
    UInt32 dwViewMode,
    ref DESKBANDINFO dbi)
{
      //… preceded by other code …

      dbi.dwModeFlags = DBIMF.BREAK;
}It would be handy if you could change the value of the dwModeFlags at design time through a property of the BandObject class using the property grid. However the property grid treats this property as an enumeration and thus you can only select a single field from the drop-down list. So you need to implement your own TypeConvertor which helps you edit bit field properties. Implementing this is beyond the scope of this article, but if you are interested in doing this then I recommend the Bit Flags Type Convertor article written by Serge Gorbenko. The sources accompagnying this article already contain this type convertor and the BandObject class exposes a property called ViewMode which you can use to tweak the behaviour of the toolbar.

Now that the BandObjectLib library has been fixed it is time to rebuild the entire solution. Afterwards you have to reregister the BandObjectLib and SampleToolbar assemblies for the GAC in order for the changes to become visible.
