GetBitmap() public static method

Returns a bitmap from the resource database, it handles localization transparent for the user.
/// Is thrown when the GlobalResource manager can't find a requested resource. ///
public static GetBitmap ( string name ) : Bitmap
name string /// The name of the requested bitmap. ///
return Bitmap
Exemplo n.º 1
0
        public virtual void UpdateStatus()
        {
            if (codon != null)
            {
                ConditionFailedAction failedAction = codon.GetFailedAction(caller);
                this.Visible = failedAction != ConditionFailedAction.Exclude;
                bool isEnabled = failedAction != ConditionFailedAction.Disable;
                if (isEnabled && menuCommand != null && menuCommand is IMenuCommand)
                {
                    isEnabled = ((IMenuCommand)menuCommand).IsEnabled;
                }
#if ModifiedForAltaxo
                // set/reset the Checked state of a item (a ToolStripMenuItem can not (!) show the Checked state, one has to use a ToolStripButton
                if (isEnabled && menuCommand != null && menuCommand is ICheckableMenuCommand)
                {
                    base.Checked = ((ICheckableMenuCommand)menuCommand).IsChecked;
                }
#endif
                this.Enabled = isEnabled;

                if (this.Visible && codon.Properties.Contains("icon"))
                {
                    Image = ResourceService.GetBitmap(StringParser.Parse(codon.Properties["icon"]));
                }
            }
        }
Exemplo n.º 2
0
        public ToolBarSplitButton(Codon codon, object caller, ArrayList subItems)
        {
            this.RightToLeft = RightToLeft.Inherit;
            this.caller      = caller;
            this.codon       = codon;
            this.subItems    = subItems;

            if (codon.Properties.Contains("label"))
            {
                Text = StringParser.Parse(codon.Properties["label"]);
            }
            if (imgButtonEnabled == null && codon.Properties.Contains("icon"))
            {
                imgButtonEnabled = ResourceService.GetBitmap(StringParser.Parse(codon.Properties["icon"]));
            }
            if (imgButtonDisabled == null && codon.Properties.Contains("disabledIcon"))
            {
                imgButtonDisabled = ResourceService.GetBitmap(StringParser.Parse(codon.Properties["disabledIcon"]));
            }
            if (imgButtonDisabled == null)
            {
                imgButtonDisabled = imgButtonEnabled;
            }
            menuCommand       = codon.AddIn.CreateObject(codon.Properties["class"]) as ICommand;
            menuCommand.Owner = this;
            UpdateStatus();
            UpdateText();
        }
Exemplo n.º 3
0
 public virtual void UpdateStatus()
 {
     if (codon != null)
     {
         ConditionFailedAction failedAction = codon.GetFailedAction(caller);
         this.Visible = failedAction != ConditionFailedAction.Exclude;
         if (!isInitialized && failedAction != ConditionFailedAction.Exclude)
         {
             isInitialized = true;
             CreateDropDownItems();                     // must be created to support shortcuts
             if (DropDownItems.Count == 0 && subItems.Count > 0)
             {
                 DropDownItems.Add(new ToolStripMenuItem());
             }
         }
         if (Image == null && codon.Properties.Contains("icon"))
         {
             try
             {
                 Image = ResourceService.GetBitmap(codon.Properties["icon"]);
             }
             catch (ResourceNotFoundException) { }
         }
     }
 }
Exemplo n.º 4
0
        public virtual void UpdateStatus()
        {
            if (codon != null)
            {
                ConditionFailedAction failedAction = codon.GetFailedAction(caller);
                bool isVisible = failedAction != ConditionFailedAction.Exclude;
                if (isVisible != Visible)
                {
                    Visible = isVisible;
                }
                if (menuCommand != null)
                {
                    bool isChecked = menuCommand.IsChecked;
                    if (isChecked != Checked)
                    {
                        Checked = isChecked;
                    }
                }

                if (this.Visible && codon.Properties.Contains("icon"))
                {
                    Image = ResourceService.GetBitmap(StringParser.Parse(codon.Properties["icon"]));
                }
            }
        }
Exemplo n.º 5
0
        public ToolBarCheckBox(Codon codon, object caller)
        {
            this.RightToLeft = RightToLeft.Inherit;
            this.caller      = caller;
            this.codon       = codon;
            try {
                menuCommand = (ICheckableMenuCommand)codon.AddIn.CreateObject(codon.Properties["class"]);
            } catch (Exception) {
            }
            if (menuCommand == null)
            {
                MessageService.ShowError("Can't create toolbar checkbox : " + codon.Id);
            }
            menuCommand.Owner = this;

            if (codon.Properties.Contains("label"))
            {
                Text = StringParser.Parse(codon.Properties["label"]);
            }
            if (Image == null && codon.Properties.Contains("icon"))
            {
                Image = ResourceService.GetBitmap(StringParser.Parse(codon.Properties["icon"]));
            }
            UpdateText();
            UpdateStatus();
        }
Exemplo n.º 6
0
 public virtual void UpdateStatus()
 {
     if (codon != null)
     {
         if (Image == null && codon.Properties.Contains("icon"))
         {
             Image = ResourceService.GetBitmap(codon.Properties["icon"]);
         }
         Visible = GetVisible();
     }
 }
Exemplo n.º 7
0
 public virtual void UpdateStatus()
 {
     if (codon != null)
     {
         if (Image == null && codon.Properties.Contains("icon"))
         {
             try {
                 Image = ResourceService.GetBitmap(codon.Properties["icon"]);
             } catch (ResourceNotFoundException) {}
         }
         Visible = GetVisible();
     }
 }
Exemplo n.º 8
0
        public virtual void UpdateStatus()
        {
            if (codon != null)
            {
                ConditionFailedAction failedAction = codon.GetFailedAction(caller);
                this.Visible = failedAction != ConditionFailedAction.Exclude;
                bool isEnabled = failedAction != ConditionFailedAction.Disable;
                if (isEnabled && menuCommand != null && menuCommand is IMenuCommand)
                {
                    isEnabled = ((IMenuCommand)menuCommand).IsEnabled;
                }
                this.Enabled = isEnabled;

                if (this.Visible && codon.Properties.Contains("icon"))
                {
                    Image = ResourceService.GetBitmap(StringParser.Parse(codon.Properties["icon"]));
                }
            }
        }
Exemplo n.º 9
0
        public ToolBarCommand(Codon codon, object caller, bool createCommand)
        {
            this.RightToLeft = RightToLeft.Inherit;
            this.caller      = caller;
            this.codon       = codon;

            if (createCommand)
            {
                menuCommand = (ICommand)codon.AddIn.CreateObject(codon.Properties["class"]);
            }

            if (codon.Properties.Contains("label"))
            {
                Text = StringParser.Parse(codon.Properties["label"]);
            }
            if (Image == null && codon.Properties.Contains("icon"))
            {
                Image = ResourceService.GetBitmap(StringParser.Parse(codon.Properties["icon"]));
            }

            UpdateStatus();
            UpdateText();
        }
Exemplo n.º 10
0
        public ToolBarDropDownButton(Codon codon, object caller, ArrayList subItems)
        {
            this.RightToLeft = RightToLeft.Inherit;
            this.caller      = caller;
            this.codon       = codon;
            this.subItems    = subItems;

            if (codon.Properties.Contains("label"))
            {
                Text = StringParser.Parse(codon.Properties["label"]);
            }
            if (Image == null && codon.Properties.Contains("icon"))
            {
                Image = ResourceService.GetBitmap(StringParser.Parse(codon.Properties["icon"]));
            }
            if (menuBuilder == null && codon.Properties.Contains("class"))
            {
                menuBuilder       = codon.AddIn.CreateObject(StringParser.Parse(codon.Properties["class"])) as ICommand;
                menuBuilder.Owner = this;
            }

            UpdateStatus();
            UpdateText();
        }