internal CommandBarItemCollection()
 {
     this.commandBar = null;
     this.items      = new ArrayList();
 }
 internal CommandBarItemCollection(CommandBar commandBar)
 {
     this.commandBar = commandBar;
     this.items      = new ArrayList();
 }
        private void CommandBar_TextChanged(object sender, EventArgs e)
        {
            CommandBar commandBar = (CommandBar)sender;

            this.UpdateBand(commandBar);
        }
        private NativeMethods.REBARBANDINFO CreateBandInfo(int index)
        {
            CommandBar commandBar = this.commandBars[index];

            NativeMethods.REBARBANDINFO rbbi = new NativeMethods.REBARBANDINFO();
            rbbi.cbSize   = Marshal.SizeOf(typeof(NativeMethods.REBARBANDINFO));
            rbbi.fMask    = 0;
            rbbi.clrFore  = 0;
            rbbi.clrBack  = 0;
            rbbi.iImage   = 0;
            rbbi.hbmBack  = IntPtr.Zero;
            rbbi.lParam   = 0;
            rbbi.cxHeader = 0;

            rbbi.fMask |= NativeMethods.RBBIM_ID;
            rbbi.wID    = 0xEB00 + index;

            if ((commandBar.Text != null) && (commandBar.Text.Length != 0))
            {
                rbbi.fMask |= NativeMethods.RBBIM_TEXT;
                rbbi.lpText = Marshal.StringToHGlobalUni(commandBar.Text);
                rbbi.cch    = (commandBar.Text == null) ? 0 : commandBar.Text.Length;
            }

            int pad = 0;

            foreach (CommandBarItem item in commandBar.Items)
            {
                if (item is CommandBarSeparator)
                {
                    pad += 2;
                }
            }

            rbbi.fMask |= NativeMethods.RBBIM_STYLE;
            rbbi.fStyle = NativeMethods.RBBS_CHILDEDGE | NativeMethods.RBBS_FIXEDBMP | NativeMethods.RBBS_GRIPPERALWAYS;
            if (commandBar.NewLine == true)
            {
                rbbi.fStyle |= NativeMethods.RBBS_BREAK;
            }
            if (commandBar.UseChevron == true)
            {
                rbbi.fStyle |= NativeMethods.RBBS_USECHEVRON;
            }

            rbbi.fMask    |= NativeMethods.RBBIM_CHILD;
            rbbi.hwndChild = commandBar.Handle;

            rbbi.fMask     |= NativeMethods.RBBIM_CHILDSIZE;
            rbbi.cyMinChild = commandBar.Height;
            rbbi.cxMinChild = 0;             //commandBar.Width;
            rbbi.cyChild    = 0;
            rbbi.cyMaxChild = commandBar.Height;
            rbbi.cyIntegral = commandBar.Height;

            rbbi.fMask |= NativeMethods.RBBIM_SIZE;
            rbbi.cx     = commandBar.Width + pad + 14;

            rbbi.fMask  |= NativeMethods.RBBIM_IDEALSIZE;
            rbbi.cxIdeal = commandBar.Width + pad + 14;

            return(rbbi);
        }
Пример #5
0
 public void Remove(CommandBar commandBar)
 {
     this.bands.Remove(commandBar);
     this.commandBarManager.UpdateBands();
 }
Пример #6
0
 public int IndexOf(CommandBar commandBar)
 {
     return(this.bands.IndexOf(commandBar));
 }
Пример #7
0
 public bool Contains(CommandBar commandBar)
 {
     return(this.bands.Contains(commandBar));
 }