コード例 #1
0
        Bar CreateToolBarFromCodon(ToolbarCodon codon)
        {
            Bar bar = new Bar();

            bar.Stretch         = true;
            bar.CanHide         = false;
            bar.GrabHandleStyle = eGrabHandleStyle.StripeFlat;
            bar.WrapItemsDock   = false;
            bar.BackColor       = SystemColors.Control;

            ResourceService     ResourceService     = (ResourceService)ServiceManager.Services.GetService(typeof(ResourceService));
            StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService));

            foreach (ToolbarItemCodon childCodon in codon.SubItems)
            {
                ButtonItem button = new ButtonItem();

                if (childCodon.Icon != null)
                {
                    button.Image = ResourceService.GetBitmap(childCodon.Icon);
                }
                if (childCodon.Text != null)
                {
                    button.Text        = stringParserService.Parse(childCodon.Text);
                    button.ButtonStyle = eButtonStyle.ImageAndText;
                }

                if (childCodon.ToolTip != null)
                {
                    if (childCodon.BeginGroup == "true")
                    {
                        button.BeginGroup = true;
                    }
                    else
                    {
                        button.Tooltip = stringParserService.Parse(childCodon.ToolTip);
                    }
                }
                button.Enabled = childCodon.Enabled;
                if (childCodon.Class != null)
                {
                    ClickWrapper clickHandler = new ClickWrapper((ICommand)childCodon.AddIn.CreateObject(childCodon.Class));
                    button.Click += new EventHandler(clickHandler.Run);
                }
                bar.Items.Add(button);
            }
            return(bar);
        }
コード例 #2
0
		Bar CreateToolBarFromCodon(ToolbarCodon codon)
		{
			Bar bar = new Bar();
			bar.Stretch=true;
			bar.CanHide=false;
			bar.GrabHandleStyle=eGrabHandleStyle.StripeFlat;
			bar.WrapItemsDock=false;
			bar.BackColor = SystemColors.Control;

			ResourceService ResourceService = (ResourceService)ServiceManager.Services.GetService(typeof(ResourceService));
			StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService));

			foreach (ToolbarItemCodon childCodon in codon.SubItems) 
			{
				ButtonItem button = new ButtonItem();
				
				if (childCodon.Icon != null) 
				{
					button.Image = ResourceService.GetBitmap(childCodon.Icon);
				}
				if (childCodon.Text != null) 
				{
					button.Text = stringParserService.Parse(childCodon.Text);
					button.ButtonStyle = eButtonStyle.ImageAndText;
				}
				
				if (childCodon.ToolTip != null) 
				{
					if (childCodon.BeginGroup == "true") 
					{
						button.BeginGroup = true;
					} 
					else 
					{
						button.Tooltip = stringParserService.Parse(childCodon.ToolTip);
					}
				}
				button.Enabled     = childCodon.Enabled;
				if (childCodon.Class != null) 
				{
					ClickWrapper clickHandler = new ClickWrapper((ICommand)childCodon.AddIn.CreateObject(childCodon.Class));
					button.Click += new EventHandler(clickHandler.Run);
				}
				bar.Items.Add(button);
			}
			return bar;
		}