Exemplo n.º 1
0
        ///<summary>
        ///  Registers new Tool Box button in main tool-set
        ///</summary>
        ///<param name="ownControl">Control owns button will be created</param>
        ///<param name="item">Instance of <see cref="ToolStripMenuItem"/> which provides information to create button</param>
        ///<param name="action">Action should be call when created button clicked</param>
        ///<returns>Action delegate to notify main form when created button should be enabled/disabled</returns>
        ///<exception cref="FireFlyException"></exception>
        public Action<bool> RegisterToolBoxButton([NotNull]Control ownControl, [NotNull]ToolStripMenuItem item, [CanBeNull]EventHandler action)
        {
            var nb = new ToolStripButton(item.Text, item.Image) { Name = item.Name, ToolTipText = item.ToolTipText, Tag = ownControl, Visible = false};
            if (item.ShortcutKeys != Keys.None)
            {
#if CHECKERS
                if (nb.ToolTipText.IsNull())
                {
                    throw new FireFlyException("{0} has empty ToolTipText property", nb.Name);
                }
#endif
                nb.ToolTipText += " (" + new KeysConverter().ConvertToString(item.ShortcutKeys) + ")";
            }
            nb.DisplayStyle = item.Image != null ? ToolStripItemDisplayStyle.Image : ToolStripItemDisplayStyle.Text;
            nb.Click += action ?? ((s, e) => item.PerformClick());
            nb.Enabled = item.Visible && item.Enabled;
            tsMain.Items.Add(nb);

            ownControl.GotFocus += (s, e) => nb.Visible = true;
            ownControl.LostFocus += (s, e) =>
            {
                nb.Visible = false;
            };
            ownControl.Disposed += (s, e) => nb.Dispose();

            return isActive =>
            {
                nb.Enabled = isActive;
                item.Visible = isActive;
            };
        }
Exemplo n.º 2
0
        public override void CloseTabPage()
        {
            //this.Controls.Clear();

            base.CloseTabPage();
            //this.drawarea.CloseDrawArea();

            //panelPageNavigation = null;
            //toolStripPageNavigation = null;
            //toolStripButtonAdd = null;
            //toolStripButtonDelete = null;
            //toolStripSeparator1 = null;
            //toolStripButtonFirst = null;
            //toolStripButtonPrevious = null;
            //toolStripLabelPageNumber = null;
            //toolStripButtonNext = null;
            //toolStripButtonLast = null;
            //drawarea = null;
            //panelTabPage = null;
            panelPageNavigation.Dispose();

            toolStripPageNavigation.Dispose();
            toolStripButtonAdd.Dispose();
            toolStripButtonDelete.Dispose();
            toolStripSeparator1.Dispose();
            toolStripButtonFirst.Dispose();
            toolStripButtonPrevious.Dispose();
            toolStripLabelPageNumber.Dispose();
            toolStripButtonNext.Dispose();
            toolStripButtonLast.Dispose();

            //drawarea = null;
        }
Exemplo n.º 3
0
        protected override void OnTermination()
        {
            if (annotPanel != null)
            {
                ChartControl.Controls.Remove(annotPanel); annotPanel.Dispose();
            }
            if (theSplitter != null)
            {
                ChartControl.Controls.Remove(theSplitter); theSplitter.Dispose();
            }

            if (strip != null)
            {
                strip.Items.Remove(hideBtn);
                hideBtn.Dispose();
            }

            dgv              = null;
            theSplitter      = null;
            strip            = null;
            hideBtn          = null;
            newBtn           = null;
            reorgBtn         = null;
            didWell          = null;
            needsImprovement = null;
            base.OnTermination();
        }
Exemplo n.º 4
0
        public override void CloseTabPage()
        {
            //bool ret = true;
            //this.Controls.Clear();

            base.CloseTabPage();


#if EWSAPP
            if (Dirty)
            {
                if (DialogResult.Yes == MessageBox.Show("Do you want to save?", "Save", MessageBoxButtons.YesNoCancel))
                {
                    SaveTabPage();
                }
            }
#endif


            //return ret;
            tblpou.Pages = null;

            panelPageNavigation.Dispose();

            toolStripPageNavigation.Dispose();
            toolStripButtonAdd.Dispose();
            toolStripButtonDelete.Dispose();
            toolStripSeparator1.Dispose();
            toolStripButtonFirst.Dispose();
            toolStripButtonPrevious.Dispose();
            toolStripLabelPageNumber.Dispose();
            toolStripButtonNext.Dispose();
            toolStripButtonLast.Dispose();

            //drawarea = null;
        }
Exemplo n.º 5
0
        public static void MasterToolStrip(ToolStrip SourceToolbar)
        {
            ToolStripButton btn = null;
            //This procedure assumes an Image List has been already attached to the
            //supplied Toolbar with the required images in the required order
            try
            {
                ToolStrip with_1 = SourceToolbar;
                with_1.Items.Add(new ToolStripSeparator()); //Add a Separator

                btn = new ToolStripButton();
                ToolStripButton with_2 = btn;
                with_2.AutoToolTip = true;
                with_2.ToolTipText = CultureSupport.TextDictionary("TT_NEW", TextReturnTypeEnum.PureString);
                with_2.Tag = "New";
                with_2.ImageIndex = 0;
                with_1.Items.Add(btn);

                btn = new ToolStripButton();
                ToolStripButton with_3 = btn;
                with_3.AutoToolTip = true;
                with_3.ToolTipText = CultureSupport.TextDictionary("TT_DELETE", TextReturnTypeEnum.PureString);
                with_3.Tag = "Delete";
                with_3.ImageIndex = 1;
                with_1.Items.Add(btn);

                btn = new ToolStripButton();
                ToolStripButton with_4 = btn;
                with_4.AutoToolTip = true;
                with_4.ToolTipText = CultureSupport.TextDictionary("TT_SAVECHANGES", TextReturnTypeEnum.PureString);
                with_4.Tag = "Save";
                with_4.ImageIndex = 2;
                with_1.Items.Add(btn);

                btn = new ToolStripButton();
                ToolStripButton with_5 = btn;
                with_5.AutoToolTip = true;
                with_5.ToolTipText = CultureSupport.TextDictionary("TT_UNDOCHANGES", TextReturnTypeEnum.PureString);
                with_5.Tag = "Undo";
                with_5.ImageIndex = 3;
                with_1.Items.Add(btn);

                with_1.Items.Add(new ToolStripSeparator());

                btn = new ToolStripButton();
                ToolStripButton with_6 = btn;
                with_6.AutoToolTip = true;
                with_6.ToolTipText = CultureSupport.TextDictionary("TT_FIND", TextReturnTypeEnum.PureString);
                with_6.Tag = "Find";
                with_6.ImageIndex = 4;
                with_1.Items.Add(btn);

                with_1.Items.Add(new ToolStripSeparator());

                btn = new ToolStripButton();
                ToolStripButton with_7 = btn;
                with_7.AutoToolTip = true;
                with_7.ToolTipText = CultureSupport.TextDictionary("TT_CLOSE", TextReturnTypeEnum.PureString);
                with_7.Tag = "Exit";
                with_7.ImageIndex = 5;
                with_1.Items.Add(btn);

            }
            catch (Exception)
            {
            }
            finally
            {
                btn.Dispose();
            }
        }
Exemplo n.º 6
0
        public static void TransactionToolStrip(ToolStrip SourceToolbar)
        {
            ToolStripItem btn = null;

            try
            {
                ToolStrip with_1 = SourceToolbar;
                with_1.Items.Add(new ToolStripSeparator()); //Add a Separator

                btn = new ToolStripButton();
                ToolStripButton with_2 = ((ToolStripButton) btn);
                with_2.AutoToolTip = true;
                with_2.ToolTipText = CultureSupport.TextDictionary("TT_SAVECHANGES", TextReturnTypeEnum.PureString);
                with_2.Tag = "Save";
                with_1.Items.Add(btn);

                btn = new ToolStripButton();
                ToolStripButton with_3 = ((ToolStripButton) btn);
                with_3.AutoToolTip = true;
                with_3.ToolTipText = CultureSupport.TextDictionary("TT_UNDOCHANGES", TextReturnTypeEnum.PureString);
                with_3.Tag = "Undo";
                with_1.Items.Add(btn);

                with_1.Items.Add(new ToolStripSeparator());

                btn = new ToolStripButton();
                ToolStripButton with_4 = ((ToolStripButton) btn);
                with_4.AutoToolTip = true;
                with_4.ToolTipText = CultureSupport.TextDictionary("TT_CLOSE", TextReturnTypeEnum.PureString);
                with_4.Tag = "Exit";
                with_1.Items.Add(btn);
            }
            catch (Exception)
            {
            }
            finally
            {
                btn.Dispose();
            }
        }