Ejemplo n.º 1
0
        /// <summary>
        /// Creates toolbar
        /// </summary>
        /// <param name="buttons">Buttons</param>
        /// <param name="tools">Tools</param>
        /// <param name="size">Size</param>
        /// <param name="translate">The "translate" sign</param>
        /// <param name="resources">Resources</param>
        /// <returns>Toolbar</returns>
        public static PaletteToolBar CreateToolBar(IList <ButtonWrapper> buttons, ToolsDiagram tools, Size size, bool translate,
                                                   Dictionary <string, object>[] resources)
        {
            ImageList imageList = new ImageList();

            imageList.ImageSize = size;
            foreach (ButtonWrapper bw in buttons)
            {
                imageList.Images.Add(bw.buttonImage);
            }
            PaletteToolBar toolbar = new PaletteToolBar(tools);

            toolbar.ImageList = imageList;
            for (int i = 0; i < buttons.Count; i++)
            {
                ButtonWrapper b  = buttons[i];
                string        tt = b.toolTipText;
                if (translate)
                {
                    tt = Resources.GetControlResource(tt, resources);
                }
                PaletteButton pb = new PaletteButton(toolbar, b.type, b.stringKind, tt, b.buttonImage, i, b.isArrow);
                if (!b.isVisible)
                {
                    pb.Visible = false;
                }
            }
            return(toolbar);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The "on click" event handler
        /// </summary>
        /// <param name="sender">The sender</param>
        /// <param name="e">The event handler arguments</param>
        protected void ToolBar_ButtonClick(Object sender, ToolBarButtonClickEventArgs e)
        {
            PaletteButton but = (PaletteButton)e.Button;

            if (active != but)
            {
                if (active != null)
                {
                    active.Pushed = false;
                }
                active = but;
            }
        }