Gary Neitzke took a few minutes to create a draft of how to create a "floating toolbar" with your addins for OneNote. This is the tecnique he used for the image rotator.
I keep putting "floating toolbar" in quotes for a reason. This really isn't a toolbar, and it can't be docked like normal toolbars. It's a great simulation of one, though, and gives you much more flexibility than the single click event exposed in the OneNote API.
If you try this out and hit problems, let me know. This is still in draft form so there may be a few hitches here and there.
public DemoForm()
{
InitializeComponent();
initToolTip();
this.Focus();
}
private void initToolTip()
ToolTip toolTips = new ToolTip();
toolTips.AutoPopDelay = 1000;
toolTips.InitialDelay = 1000;
toolTips.ReshowDelay = 500;
toolTips.ShowAlways = true;
toolTips.SetToolTip(this.button1, "This is Button 1");
toolTips.SetToolTip(this.button2, "This is Button 2");
toolTips.SetToolTip(this.button3, "This is Button 3");
toolTips.SetToolTip(this.button4, "This is Button 4");
Tip:
Called from your form during Form Load event
Call:
SetWindowPos(this.Handle, new IntPtr(-1), Location.X, Location.Y, Size.Width, Size.Height, 0);
Function:
/// <summary>
/// http://msdn2.microsoft.com/en-us/library/ms633545.aspx
/// </summary>
/// <param name="hWnd"></param>
/// <param name="hWndInsertAfter">-1 Stands for TopMost</param>
/// <param name="X"></param>
/// <param name="Y"></param>
/// <param name="cx"></param>
/// <param name="cy"></param>
/// <param name="uFlags"></param>
/// <returns></returns>
[DllImport("user32.dll")]
internal static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X,
int Y, int cx, int cy, uint uFlags);
That's it!
Questions, comments, concerns and criticisms always welcome,
John