Ok, well how about we forget about modifying the built in toolbar and instead we'll build one from scratch? Are you up to the challenge??
It will be a good tutorial for anyone who wants to know how to create collection based controls with rich design time support and you'll get what you want in the end, everyone's a winner in my book.
Plus you'll have something that no-one else will!!!
Step 1:
Create a new solution in VS and add a new windows control library to the solution and also add a standard windows application as well. Delete the custom control that is automatically added to the library project and add a new class... this is the point where you get to name your new control, call what ever you like...
Your class should now look like this...
Imports System.ComponentModel
Imports System.Drawing
Public Class 'Whatever you want to call it
Inherits System.Windows.Forms.Control
Public Sub New()
'I haven't used these for a while but as I remember we can treat
the controlstyles enum as a set of bit flags and set them like this.
What we are doing here is telling the base class that we want
our control doublebuffered to reduce flicker when repainting,
AllpaintingInWm_Paint tells our base class to intercept the
WM_EraseBackground message, and the userpaint bit
tells our base class that we want our control to handle it's own painting.
Mybase.Setstyle(ControlStyles.DoubleBuffer Or _
ControlStyles.AllPaintingInWM_Paint Or ControlStyles.UserPaint, True)
Me.Dock = DockStyle.Left
End Sub
'We can put all this in a partial class if we wanted to but to be honest it's out of the scope of this tutorial.
Now's a good a time as any to build the project, add our control library project as a reference in the windows application but add it as a
project reference. Then customize the toolbox browse to the folder where our new .dll is stored double click it and you will then see your new control in the toolbox. Drag it onto the form and voila, you will see practically bugger all, just a square block. The reason we do it likethis is becuase now any changes you make to our new control will be reflected directly to that control on the form every time we re-build the project. Now the fun begins...