Ejemplo n.º 1
0
        public void Show(Control control, Point point)
        {
            CommandBarItemCollection chevronItems = new CommandBarItemCollection();
            Size size = ClientSize;

            for (int i = 0; i < items.Count; i++)
            {
                NativeMethods.RECT rect = new NativeMethods.RECT();
                NativeMethods.SendMessage(Handle, NativeMethods.TB_GETITEMRECT, i, ref rect);
                if (rect.right > size.Width)
                {
                    CommandBarItem item = items[i];
                    if (item.Visible)
                    {
                        if ((!(item is CommandBarSeparator)) || (chevronItems.Count != 0))
                        {
                            chevronItems.Add(item);
                        }
                    }
                }
            }

            this.contextMenu.Mnemonics = false;
            this.contextMenu.Items.Clear();
            this.contextMenu.Items.AddRange(chevronItems);
            this.contextMenu.Show(control, point);
        }
Ejemplo n.º 2
0
		public CommandBar()
		{
			this.items = new CommandBarItemCollection(this);
			this.SetStyle(ControlStyles.UserPaint, false);
			this.TabStop = false;
			this.Font = SystemInformation.MenuFont;
			this.Dock = DockStyle.Top;
		}	
Ejemplo n.º 3
0
 public CommandBar()
 {
     this.items = new CommandBarItemCollection(this);
     this.SetStyle(ControlStyles.UserPaint, false);
     this.TabStop = false;
     this.Font    = SystemInformation.MenuFont;
     this.Dock    = DockStyle.Top;
 }
Ejemplo n.º 4
0
		protected override void Dispose(bool disposing)
		{
			if (disposing)
			{
				this.items.Clear();
				this.items = null;

				this.contextMenu = null;
			}

			base.Dispose(disposing);
		}
Ejemplo n.º 5
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                this.items.Clear();
                this.items = null;

                this.contextMenu = null;
            }

            base.Dispose(disposing);
        }
Ejemplo n.º 6
0
		/// <summary>
		/// Add the contents of this MergableMenu to a CommandBarMenu
		/// </summary>
		/// <param name="menu"></param>
		public void Apply(CommandBarItemCollection items)
		{
			int lastGroup = -1;

			foreach (MergableItem item in List)
			{
				if (item.Group != lastGroup && lastGroup > -1)
					items.AddSeparator();

				items.Add(item.Apply());
				lastGroup = item.Group;
			}
		}
Ejemplo n.º 7
0
        private static Size GetImageSize(CommandBarItemCollection items)
        {
            Size imageSize = new Size(16, 16);
            for (int i = 0; i < items.Count; i++)
            {
                Image image = items[i].Image;
                if (image != null)
                {
                    if (image.Width > imageSize.Width)
                    {
                        imageSize.Width = image.Width;
                    }

                    if (image.Height > imageSize.Height)
                    {
                        imageSize.Height = image.Height;
                    }
                }
            }

            return imageSize;
        }
Ejemplo n.º 8
0
        private static Size GetImageSize(CommandBarItemCollection items)
        {
            Size imageSize = new Size(16, 16);

            for (int i = 0; i < items.Count; i++)
            {
                Image image = items[i].Image;
                if (image != null)
                {
                    if (image.Width > imageSize.Width)
                    {
                        imageSize.Width = image.Width;
                    }

                    if (image.Height > imageSize.Height)
                    {
                        imageSize.Height = image.Height;
                    }
                }
            }

            return(imageSize);
        }
Ejemplo n.º 9
0
		public void Show(Control control, Point point)
		{
			CommandBarItemCollection chevronItems = new CommandBarItemCollection();
			Size size = ClientSize;
			for (int i = 0; i < items.Count; i++)
			{
				NativeMethods.RECT rect = new NativeMethods.RECT();
				NativeMethods.SendMessage(Handle, NativeMethods.TB_GETITEMRECT, i, ref rect);
				if (rect.right > size.Width)
				{
					CommandBarItem item = items[i];
					if (item.IsVisible) 
					{
						if ((!(item is CommandBarSeparator)) || (chevronItems.Count != 0))
							chevronItems.Add(item);
					}
				}
			}

			this.contextMenu.Mnemonics = false;
			this.contextMenu.Items.Clear();
			this.contextMenu.Items.AddRange(chevronItems);
			this.contextMenu.Show(control, point);
		}