Example #1
0
        public static Byte[] LoadImage(Image pImage, string pExtension)
        {
            Byte[] imgByte = null;
            switch (pExtension)
            {
            case "":
            case null:
            case ".jpeg":
            case ".jpg":
            {
                imgByte = TypeFunctions.ConvertImageToByteArray(pImage, ImageFormat.Jpeg);

                break;
            }

            case ".gif":
            {
                imgByte = TypeFunctions.ConvertImageToByteArray(pImage, ImageFormat.Gif);

                break;
            }
            }


            return(imgByte);
        }
Example #2
0
        protected override void SaveModifications()
        {
            bool exist = false;

            if (ActionType == Fwk.UI.Common.ActionTypes.Create)
            {
                if (_ParentGroup != null) // se debe validar ya que si no tiene otros nodos el parent es null
                {
                    if (_ParentGroup.ContainTree)
                    {
                        exist = _ParentGroup.MenuBarTree.Exist(txtId.Text);
                    }
                    else
                    {
                        exist = _ParentGroup.Buttons.Exist(txtId.Text);
                    }
                }


                if (exist)
                {
                    if (SimpleMessageView.Show(string.Concat("Ya existe un ID = ", txtId.Text, ". ¿Desea sobre escribir este item de menú?"),
                                               "Menu", MessageBoxButtons.YesNo, Fwk.UI.Common.MessageBoxIcon.Question) == DialogResult.No)
                    {
                        txtId.SelectAll();
                        txtId.Focus();
                        return;
                    }


                    List <Fwk.UI.Controls.Menu.ButtonBase> a = (from item in _ParentGroup.Buttons
                                                                where item.Id.Equals(txtId.Text.Trim(), StringComparison.OrdinalIgnoreCase)
                                                                select item).ToList <Fwk.UI.Controls.Menu.ButtonBase>();

                    _CopyButton = a[0];
                }
            }
            _CopyButton.Id           = txtId.Text;
            _CopyButton.AssemblyInfo = txtAssemblyInfo.Text;
            _CopyButton.Caption      = txtCaption.Text;
            _CopyButton.Shortcut     = txtShortCut.Text;
            _CopyButton.ToolTipText  = txtToolTip.Text;


            if (pctSmallImage.Image != null)
            {
                _CopyButton.Image = TypeFunctions.ConvertImageToByteArray(pctSmallImage.Image, ImageFormat.Png);
            }
            if (pctLargeImage.Image != null)
            {
                _CopyButton.LargeImage = TypeFunctions.ConvertImageToByteArray(pctLargeImage.Image, ImageFormat.Png);
            }

            OnMenuItemSaved(new MenuItemSavedEventArgs(_CopyButton));
        }
Example #3
0
        protected override void SaveModifications()
        {
            //_OriginalButton.BeginGroup = _Button.BeginGroup;
            _OriginalButton.Caption = _Button.Caption;
            _OriginalButton.Hint    = _Button.Hint;
            _OriginalButton.Id      = _Button.Id;
            if (pctImage.Image != null)
            {
                _OriginalButton.Image = TypeFunctions.ConvertImageToByteArray(pctImage.Image, ImageFormat.Png);
            }
            _OriginalButton.Shortcut    = _Button.Shortcut;
            _OriginalButton.ToolTipText = _Button.ToolTipText;

            OnMenuItemSaved(new MenuItemSavedEventArgs(_OriginalButton));
        }
Example #4
0
 private void btnLoadLargeImage_Click(object sender, EventArgs e)
 {
     GetImage(pctLargeImage);
     _CopyButton.LargeImage = TypeFunctions.ConvertImageToByteArray(pctLargeImage.Image, ImageFormat.Png);
 }