private void InitializeComponent()
        {
            ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(EncyclopediaEntryDetailsForm));

            this.Browser             = new WebBrowser();
            this.Toolbar             = new ToolStrip();
            this.DMBtn               = new ToolStripButton();
            this.toolStripSeparator2 = new ToolStripSeparator();
            this.ExportMenu          = new ToolStripDropDownButton();
            this.ExportHTML          = new ToolStripMenuItem();
            this.PlayerViewBtn       = new ToolStripButton();
            this.Toolbar.SuspendLayout();
            base.SuspendLayout();
            this.Browser.Dock = DockStyle.Fill;
            this.Browser.IsWebBrowserContextMenuEnabled = false;
            this.Browser.Location = new Point(0, 25);
            this.Browser.Name     = "Browser";
            this.Browser.ScriptErrorsSuppressed = true;
            this.Browser.Size     = new System.Drawing.Size(372, 337);
            this.Browser.TabIndex = 2;
            this.Browser.WebBrowserShortcutsEnabled = false;
            this.Browser.Navigating += new WebBrowserNavigatingEventHandler(this.Browser_Navigating);
            ToolStripItemCollection items = this.Toolbar.Items;

            ToolStripItem[] dMBtn = new ToolStripItem[] { this.DMBtn, this.toolStripSeparator2, this.ExportMenu, this.PlayerViewBtn };
            items.AddRange(dMBtn);
            this.Toolbar.Location            = new Point(0, 0);
            this.Toolbar.Name                = "Toolbar";
            this.Toolbar.Size                = new System.Drawing.Size(372, 25);
            this.Toolbar.TabIndex            = 3;
            this.Toolbar.Text                = "toolStrip1";
            this.DMBtn.DisplayStyle          = ToolStripItemDisplayStyle.Text;
            this.DMBtn.Image                 = (Image)componentResourceManager.GetObject("DMBtn.Image");
            this.DMBtn.ImageTransparentColor = Color.Magenta;
            this.DMBtn.Name   = "DMBtn";
            this.DMBtn.Size   = new System.Drawing.Size(86, 22);
            this.DMBtn.Text   = "Show DM Info";
            this.DMBtn.Click += new EventHandler(this.DMBtn_Click);
            this.toolStripSeparator2.Name = "toolStripSeparator2";
            this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25);
            this.ExportMenu.DisplayStyle  = ToolStripItemDisplayStyle.Text;
            this.ExportMenu.DropDownItems.AddRange(new ToolStripItem[] { this.ExportHTML });
            this.ExportMenu.Image = (Image)componentResourceManager.GetObject("ExportMenu.Image");
            this.ExportMenu.ImageTransparentColor = Color.Magenta;
            this.ExportMenu.Name                     = "ExportMenu";
            this.ExportMenu.Size                     = new System.Drawing.Size(53, 22);
            this.ExportMenu.Text                     = "Export";
            this.ExportHTML.Name                     = "ExportHTML";
            this.ExportHTML.Size                     = new System.Drawing.Size(157, 22);
            this.ExportHTML.Text                     = "Export to HTML";
            this.ExportHTML.Click                   += new EventHandler(this.ExportHTML_Click);
            this.PlayerViewBtn.DisplayStyle          = ToolStripItemDisplayStyle.Text;
            this.PlayerViewBtn.Image                 = (Image)componentResourceManager.GetObject("PlayerViewBtn.Image");
            this.PlayerViewBtn.ImageTransparentColor = Color.Magenta;
            this.PlayerViewBtn.Name                  = "PlayerViewBtn";
            this.PlayerViewBtn.Size                  = new System.Drawing.Size(114, 22);
            this.PlayerViewBtn.Text                  = "Send to Player View";
            this.PlayerViewBtn.Click                += new EventHandler(this.PlayerViewBtn_Click);
            base.AutoScaleDimensions                 = new SizeF(6f, 13f);
            base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            base.ClientSize    = new System.Drawing.Size(372, 362);
            base.Controls.Add(this.Browser);
            base.Controls.Add(this.Toolbar);
            base.MaximizeBox   = false;
            base.MinimizeBox   = false;
            base.Name          = "EncyclopediaEntryDetailsForm";
            base.ShowIcon      = false;
            base.ShowInTaskbar = false;
            base.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
            base.StartPosition = FormStartPosition.CenterParent;
            this.Text          = "Encyclopedia Entry";
            this.Toolbar.ResumeLayout(false);
            this.Toolbar.PerformLayout();
            base.ResumeLayout(false);
            base.PerformLayout();
        }
Пример #2
0
 public void GetServerUAMenu(ToolStripItemCollection items)
 {
     GetInstanceMenuItems(items);
 }
Пример #3
0
 /// <summary>
 /// Build a ToolBar that matches the Content of a MenuItem
 /// </summary>
 /// <param name="tb"></param>
 /// <param name="mi"></param>
 /// <param name="exclude">List of <see cref="TD.SandBar.MenuButtonItem"/> that should be excluded</param>
 public static void BuildToolBar(ToolStrip tb, ToolStripItemCollection mi)
 {
     BuildToolBar(tb, mi, exclude);
 }
Пример #4
0
        /* private static void CheckCompatibilityRefl(string strFile)
         * {
         *      ResolveEventHandler eh = delegate(object sender, ResolveEventArgs e)
         *      {
         *              string strName = e.Name;
         *              if(strName.Equals("KeePass", StrUtil.CaseIgnoreCmp) ||
         *                      strName.StartsWith("KeePass,", StrUtil.CaseIgnoreCmp))
         *                      return Assembly.ReflectionOnlyLoadFrom(WinUtil.GetExecutable());
         *
         *              return Assembly.ReflectionOnlyLoad(strName);
         *      };
         *
         *      AppDomain d = AppDomain.CurrentDomain;
         *      d.ReflectionOnlyAssemblyResolve += eh;
         *      try
         *      {
         *              Assembly asm = Assembly.ReflectionOnlyLoadFrom(strFile);
         *              asm.GetTypes();
         *      }
         *      finally { d.ReflectionOnlyAssemblyResolve -= eh; }
         * } */

        internal void AddMenuItems(PluginMenuType t, ToolStripItemCollection c,
                                   ToolStripItem tsiPrev)
        {
            if (c == null)
            {
                Debug.Assert(false); return;
            }

            List <ToolStripItem> l = new List <ToolStripItem>();

            foreach (PluginInfo pi in m_vPlugins)
            {
                if (pi == null)
                {
                    Debug.Assert(false); continue;
                }

                Plugin p = pi.Interface;
                if (p == null)
                {
                    Debug.Assert(false); continue;
                }

                ToolStripMenuItem tsmi = p.GetMenuItem(t);
                if (tsmi != null)
                {
                    // string strTip = tsmi.ToolTipText;
                    // if((strTip == null) || (strTip == tsmi.Text))
                    //	strTip = string.Empty;
                    // if(strTip.Length != 0) strTip += MessageService.NewParagraph;
                    // strTip += KPRes.Plugin + ": " + pi.Name;
                    // tsmi.ToolTipText = strTip;

                    l.Add(tsmi);
                }
            }
            if (l.Count == 0)
            {
                return;
            }

            int iPrev = ((tsiPrev != null) ? c.IndexOf(tsiPrev) : -1);

            if (iPrev < 0)
            {
                Debug.Assert(false); iPrev = c.Count - 1;
            }
            int iIns = iPrev + 1;

            l.Sort(PluginManager.CompareToolStripItems);
            if ((iPrev >= 0) && (iPrev < c.Count) && !(c[iPrev] is ToolStripSeparator))
            {
                l.Insert(0, new ToolStripSeparator());
            }
            if ((iIns < c.Count) && !(c[iIns] is ToolStripSeparator))
            {
                l.Add(new ToolStripSeparator());
            }

            if (iIns == c.Count)
            {
                c.AddRange(l.ToArray());
            }
            else
            {
                for (int i = 0; i < l.Count; ++i)
                {
                    c.Insert(iIns + i, l[i]);
                }
            }
        }
        /// <summary>
        /// Recursive helper function for LocalizeUtils.LocalizeForm.
        /// </summary>
        internal void LocalizeToolStripCollection(string formName, string formClassName, ToolStripItemCollection collection)
        {
            if (null == formName || null == collection)
            {
                return;
            }
            int count = collection.Count;

            for (int i = 0; i < count; i++)
            {
                ToolStripItem tsi = collection[i];
                if (!string.IsNullOrEmpty(tsi.Text))
                {
                    string key = formName + "::" + tsi.Name + "::Text";
                    string value;
                    if (m_dialog_list.TryGetValue(key, out value))
                    {
                        tsi.Text = value;
                    }
                    else if (!string.IsNullOrEmpty(formClassName))
                    {
                        key = formClassName + "::" + tsi.Name + "::Text";
                        if (m_dialog_list.TryGetValue(key, out value))
                        {
                            tsi.Text = value;
                        }
                    }
                }
                if (!string.IsNullOrEmpty(tsi.ToolTipText))
                {
                    string[] tool_tip_text = { "::ToolTipText", "::ToolTip" };
                    foreach (string t in tool_tip_text)
                    {
                        string key = formName + "::" + tsi.Name + t;
                        string value;
                        if (m_dialog_list.TryGetValue(key, out value))
                        {
                            tsi.ToolTipText = value;
                            break;
                        }
                        if (!string.IsNullOrEmpty(formClassName))
                        {
                            key = formClassName + "::" + tsi.Name + t;
                            if (m_dialog_list.TryGetValue(key, out value))
                            {
                                tsi.ToolTipText = value;
                                break;
                            }
                        }
                    }
                }
                if (null != (tsi as ToolStripDropDownItem))
                {
                    LocalizeToolStripCollection(formName, formClassName, (tsi as ToolStripDropDownItem).DropDownItems);
                }
            }
        }
Пример #6
0
        private void InitializeComponent()
        {
            ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(TokenLinkListForm));

            this.Toolbar    = new ToolStrip();
            this.RemoveBtn  = new ToolStripButton();
            this.EditBtn    = new ToolStripButton();
            this.EffectList = new ListView();
            this.LinkHdr    = new ColumnHeader();
            this.TokenHdr   = new ColumnHeader();
            this.Toolbar.SuspendLayout();
            base.SuspendLayout();
            ToolStripItemCollection items = this.Toolbar.Items;

            ToolStripItem[] removeBtn = new ToolStripItem[] { this.RemoveBtn, this.EditBtn };
            items.AddRange(removeBtn);
            this.Toolbar.Location                = new Point(0, 0);
            this.Toolbar.Name                    = "Toolbar";
            this.Toolbar.Size                    = new System.Drawing.Size(429, 25);
            this.Toolbar.TabIndex                = 0;
            this.Toolbar.Text                    = "toolStrip1";
            this.RemoveBtn.DisplayStyle          = ToolStripItemDisplayStyle.Text;
            this.RemoveBtn.Image                 = (Image)componentResourceManager.GetObject("RemoveBtn.Image");
            this.RemoveBtn.ImageTransparentColor = Color.Magenta;
            this.RemoveBtn.Name                  = "RemoveBtn";
            this.RemoveBtn.Size                  = new System.Drawing.Size(54, 22);
            this.RemoveBtn.Text                  = "Remove";
            this.RemoveBtn.Click                += new EventHandler(this.RemoveBtn_Click);
            this.EditBtn.DisplayStyle            = ToolStripItemDisplayStyle.Text;
            this.EditBtn.Image                   = (Image)componentResourceManager.GetObject("EditBtn.Image");
            this.EditBtn.ImageTransparentColor   = Color.Magenta;
            this.EditBtn.Name                    = "EditBtn";
            this.EditBtn.Size                    = new System.Drawing.Size(31, 22);
            this.EditBtn.Text                    = "Edit";
            this.EditBtn.Click                  += new EventHandler(this.EditBtn_Click);
            ListView.ColumnHeaderCollection columns = this.EffectList.Columns;
            ColumnHeader[] tokenHdr = new ColumnHeader[] { this.TokenHdr, this.LinkHdr };
            columns.AddRange(tokenHdr);
            this.EffectList.Dock          = DockStyle.Fill;
            this.EffectList.FullRowSelect = true;
            this.EffectList.HeaderStyle   = ColumnHeaderStyle.Nonclickable;
            this.EffectList.HideSelection = false;
            this.EffectList.Location      = new Point(0, 25);
            this.EffectList.MultiSelect   = false;
            this.EffectList.Name          = "EffectList";
            this.EffectList.Size          = new System.Drawing.Size(429, 172);
            this.EffectList.TabIndex      = 1;
            this.EffectList.UseCompatibleStateImageBehavior = false;
            this.EffectList.View         = View.Details;
            this.EffectList.DoubleClick += new EventHandler(this.EditBtn_Click);
            this.LinkHdr.Text            = "Link";
            this.LinkHdr.Width           = 150;
            this.TokenHdr.Text           = "Tokens";
            this.TokenHdr.Width          = 250;
            base.AutoScaleDimensions     = new SizeF(6f, 13f);
            base.AutoScaleMode           = System.Windows.Forms.AutoScaleMode.Font;
            base.ClientSize              = new System.Drawing.Size(429, 197);
            base.Controls.Add(this.EffectList);
            base.Controls.Add(this.Toolbar);
            base.MaximizeBox   = false;
            base.MinimizeBox   = false;
            base.Name          = "TokenLinkListForm";
            base.ShowIcon      = false;
            base.ShowInTaskbar = false;
            base.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
            base.StartPosition = FormStartPosition.CenterParent;
            this.Text          = "Token Links";
            this.Toolbar.ResumeLayout(false);
            this.Toolbar.PerformLayout();
            base.ResumeLayout(false);
            base.PerformLayout();
        }
Пример #7
0
        private void InitializeComponent()
        {
            ListViewGroup            listViewGroup            = new ListViewGroup("Magic Items", HorizontalAlignment.Left);
            ListViewGroup            listViewGroup1           = new ListViewGroup("Mundane Parcels", HorizontalAlignment.Left);
            ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(ParcelSelectForm));

            this.OKBtn               = new Button();
            this.CancelBtn           = new Button();
            this.NameHdr             = new ColumnHeader();
            this.DetailsHdr          = new ColumnHeader();
            this.ParcelList          = new ListView();
            this.ListPanel           = new Panel();
            this.Toolbar             = new ToolStrip();
            this.ChangeItemBtn       = new ToolStripButton();
            this.StatBlockBtn        = new ToolStripButton();
            this.toolStripSeparator1 = new ToolStripSeparator();
            this.RandomiseAllBtn     = new ToolStripButton();
            this.RandomiseBtn        = new ToolStripButton();
            this.ListPanel.SuspendLayout();
            this.Toolbar.SuspendLayout();
            base.SuspendLayout();
            this.OKBtn.Anchor                      = AnchorStyles.Bottom | AnchorStyles.Right;
            this.OKBtn.DialogResult                = System.Windows.Forms.DialogResult.OK;
            this.OKBtn.Location                    = new Point(318, 348);
            this.OKBtn.Name                        = "OKBtn";
            this.OKBtn.Size                        = new System.Drawing.Size(75, 23);
            this.OKBtn.TabIndex                    = 3;
            this.OKBtn.Text                        = "OK";
            this.OKBtn.UseVisualStyleBackColor     = true;
            this.OKBtn.Click                      += new EventHandler(this.OKBtn_Click);
            this.CancelBtn.Anchor                  = AnchorStyles.Bottom | AnchorStyles.Right;
            this.CancelBtn.DialogResult            = System.Windows.Forms.DialogResult.Cancel;
            this.CancelBtn.Location                = new Point(399, 348);
            this.CancelBtn.Name                    = "CancelBtn";
            this.CancelBtn.Size                    = new System.Drawing.Size(75, 23);
            this.CancelBtn.TabIndex                = 4;
            this.CancelBtn.Text                    = "Cancel";
            this.CancelBtn.UseVisualStyleBackColor = true;
            this.NameHdr.Text                      = "Parcel";
            this.NameHdr.Width                     = 150;
            this.DetailsHdr.Text                   = "Details";
            this.DetailsHdr.Width                  = 275;
            ListView.ColumnHeaderCollection columns = this.ParcelList.Columns;
            ColumnHeader[] nameHdr = new ColumnHeader[] { this.NameHdr, this.DetailsHdr };
            columns.AddRange(nameHdr);
            this.ParcelList.Dock          = DockStyle.Fill;
            this.ParcelList.FullRowSelect = true;
            listViewGroup.Header          = "Magic Items";
            listViewGroup.Name            = "listViewGroup1";
            listViewGroup1.Header         = "Mundane Parcels";
            listViewGroup1.Name           = "listViewGroup2";
            this.ParcelList.Groups.AddRange(new ListViewGroup[] { listViewGroup, listViewGroup1 });
            this.ParcelList.HideSelection = false;
            this.ParcelList.Location      = new Point(0, 25);
            this.ParcelList.MultiSelect   = false;
            this.ParcelList.Name          = "ParcelList";
            this.ParcelList.Size          = new System.Drawing.Size(462, 305);
            this.ParcelList.TabIndex      = 0;
            this.ParcelList.UseCompatibleStateImageBehavior = false;
            this.ParcelList.View         = View.Details;
            this.ParcelList.DoubleClick += new EventHandler(this.TileList_DoubleClick);
            this.ListPanel.Anchor        = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
            this.ListPanel.Controls.Add(this.ParcelList);
            this.ListPanel.Controls.Add(this.Toolbar);
            this.ListPanel.Location = new Point(12, 12);
            this.ListPanel.Name     = "ListPanel";
            this.ListPanel.Size     = new System.Drawing.Size(462, 330);
            this.ListPanel.TabIndex = 5;
            ToolStripItemCollection items = this.Toolbar.Items;

            ToolStripItem[] changeItemBtn = new ToolStripItem[] { this.ChangeItemBtn, this.StatBlockBtn, this.toolStripSeparator1, this.RandomiseBtn, this.RandomiseAllBtn };
            items.AddRange(changeItemBtn);
            this.Toolbar.Location                      = new Point(0, 0);
            this.Toolbar.Name                          = "Toolbar";
            this.Toolbar.Size                          = new System.Drawing.Size(462, 25);
            this.Toolbar.TabIndex                      = 1;
            this.Toolbar.Text                          = "toolStrip1";
            this.ChangeItemBtn.DisplayStyle            = ToolStripItemDisplayStyle.Text;
            this.ChangeItemBtn.Image                   = (Image)componentResourceManager.GetObject("ChangeItemBtn.Image");
            this.ChangeItemBtn.ImageTransparentColor   = Color.Magenta;
            this.ChangeItemBtn.Name                    = "ChangeItemBtn";
            this.ChangeItemBtn.Size                    = new System.Drawing.Size(115, 22);
            this.ChangeItemBtn.Text                    = "Change Magic Item";
            this.ChangeItemBtn.Click                  += new EventHandler(this.ChangeItemBtn_Click);
            this.StatBlockBtn.DisplayStyle             = ToolStripItemDisplayStyle.Text;
            this.StatBlockBtn.Image                    = (Image)componentResourceManager.GetObject("StatBlockBtn.Image");
            this.StatBlockBtn.ImageTransparentColor    = Color.Magenta;
            this.StatBlockBtn.Name                     = "StatBlockBtn";
            this.StatBlockBtn.Size                     = new System.Drawing.Size(63, 22);
            this.StatBlockBtn.Text                     = "Stat Block";
            this.StatBlockBtn.Click                   += new EventHandler(this.StatBlockBtn_Click);
            this.toolStripSeparator1.Name              = "toolStripSeparator1";
            this.toolStripSeparator1.Size              = new System.Drawing.Size(6, 25);
            this.RandomiseAllBtn.DisplayStyle          = ToolStripItemDisplayStyle.Text;
            this.RandomiseAllBtn.Image                 = (Image)componentResourceManager.GetObject("RandomiseAllBtn.Image");
            this.RandomiseAllBtn.ImageTransparentColor = Color.Magenta;
            this.RandomiseAllBtn.Name                  = "RandomiseAllBtn";
            this.RandomiseAllBtn.Size                  = new System.Drawing.Size(87, 22);
            this.RandomiseAllBtn.Text                  = "Randomise All";
            this.RandomiseAllBtn.Click                += new EventHandler(this.RandomiseAllBtn_Click);
            this.RandomiseBtn.DisplayStyle             = ToolStripItemDisplayStyle.Text;
            this.RandomiseBtn.Image                    = (Image)componentResourceManager.GetObject("RandomiseBtn.Image");
            this.RandomiseBtn.ImageTransparentColor    = Color.Magenta;
            this.RandomiseBtn.Name                     = "RandomiseBtn";
            this.RandomiseBtn.Size                     = new System.Drawing.Size(70, 22);
            this.RandomiseBtn.Text                     = "Randomise";
            this.RandomiseBtn.Click                   += new EventHandler(this.RandomiseBtn_Click);
            base.AcceptButton                          = this.OKBtn;
            base.AutoScaleDimensions                   = new SizeF(6f, 13f);
            base.AutoScaleMode                         = System.Windows.Forms.AutoScaleMode.Font;
            base.CancelButton                          = this.CancelBtn;
            base.ClientSize = new System.Drawing.Size(486, 383);
            base.Controls.Add(this.ListPanel);
            base.Controls.Add(this.CancelBtn);
            base.Controls.Add(this.OKBtn);
            base.MaximizeBox   = false;
            base.MinimizeBox   = false;
            base.Name          = "ParcelSelectForm";
            base.ShowIcon      = false;
            base.ShowInTaskbar = false;
            base.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
            base.StartPosition = FormStartPosition.CenterParent;
            this.Text          = "Select a Treasure Parcel";
            base.FormClosed   += new FormClosedEventHandler(this.ParcelSelectForm_FormClosed);
            this.ListPanel.ResumeLayout(false);
            this.ListPanel.PerformLayout();
            this.Toolbar.ResumeLayout(false);
            this.Toolbar.PerformLayout();
            base.ResumeLayout(false);
        }
Пример #8
0
            private void AddMenuItems(int currGroupIndex, ref int currentListIndex, ToolStripItemCollection currNodes, string prevGroupByField)
            {
                IList innerList = this.m_currencyManager.List;
                System.ComponentModel.PropertyDescriptor pdPrevGroupBy = null;
                string prevGroupByValue = null;

                SPTreeNodeGroup currGroup;

                if (prevGroupByField != "")
                {
                    pdPrevGroupBy = this.m_currencyManager.GetItemProperties()[prevGroupByField];
                }

                currGroupIndex++;

                if (treeGroups.Count > currGroupIndex)
                {
                    currGroup = (SPTreeNodeGroup) (treeGroups[currGroupIndex]);
                    PropertyDescriptor pdGroupBy = null;
                    PropertyDescriptor pdValue = null;
                    PropertyDescriptor pdDisplay = null;

                    pdGroupBy = this.m_currencyManager.GetItemProperties()[currGroup.GroupBy];
                    pdValue = this.m_currencyManager.GetItemProperties()[currGroup.ValueMember];
                    pdDisplay = this.m_currencyManager.GetItemProperties()[currGroup.DisplayMember];

                    string currGroupBy = null;

                    if (innerList.Count > currentListIndex)
                    {
                        if (pdPrevGroupBy != null)
                        {
                            prevGroupByValue = pdPrevGroupBy.GetValue(innerList[currentListIndex]).ToString();
                        }

                        SPMenuStripItem myFirstNode = null;
                        object currObject = null;

                        while ((currentListIndex < innerList.Count) && (pdPrevGroupBy != null) && (pdPrevGroupBy.GetValue(innerList[currentListIndex]).ToString() == prevGroupByValue))
                        {
                            currObject = innerList[currentListIndex];
                            if (pdGroupBy.GetValue(currObject).ToString() != currGroupBy)
                            {
                                currGroupBy = pdGroupBy.GetValue(currObject).ToString();

                                myFirstNode = new SPMenuStripItem(currGroup.Name, pdDisplay.GetValue(currObject).ToString(), currObject, pdValue.GetValue(innerList[currentListIndex]), currGroup.ImageIndex, currentListIndex);

                                currNodes.Add(myFirstNode);
                            }
                            else
                            {
                                AddMenuItems(currGroupIndex, ref currentListIndex, this.Items, currGroup.GroupBy);
                            }
                        }
                    }
                }
                else
                {
                    SPMenuStripItem myNewLeafNode;
                    object currObject = this.m_currencyManager.List[currentListIndex];

                    if ((this.DisplayMember != null) && (this.ValueMember != null) && (this.DisplayMember != "") && (this.ValueMember != ""))
                    {
                        PropertyDescriptor pdDisplayloc = this.m_currencyManager.GetItemProperties()[this.DisplayMember];
                        PropertyDescriptor pdValueloc = this.m_currencyManager.GetItemProperties()[this.ValueMember];

                        if (this.Tag == null)
                        {
                            myNewLeafNode = new SPMenuStripItem("", pdDisplayloc.GetValue(currObject).ToString(), currObject, pdValueloc.GetValue(currObject), currentListIndex);
                        }
                        else
                        {
                            myNewLeafNode = new SPMenuStripItem(this.Tag.ToString(), pdDisplayloc.GetValue(currObject).ToString(), currObject, pdValueloc.GetValue(currObject), currentListIndex);
                        }
                    }
                    else
                    {
                        myNewLeafNode = new SPMenuStripItem("", currentListIndex.ToString(), currObject, currObject, currentListIndex, currentListIndex);
                    }

                    currNodes.Add(myNewLeafNode);
                    currentListIndex++;
                }
            }
Пример #9
0
        private void InitializeComponent()
        {
            ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(GoalListForm));

            this.OKBtn               = new Button();
            this.CancelBtn           = new Button();
            this.Splitter            = new SplitContainer();
            this.GoalTree            = new TreeView();
            this.BrowserPanel        = new System.Windows.Forms.Panel();
            this.Browser             = new WebBrowser();
            this.Toolbar             = new ToolStrip();
            this.AddBtn              = new ToolStripButton();
            this.RemoveBtn           = new ToolStripButton();
            this.EditBtn             = new ToolStripButton();
            this.Panel               = new System.Windows.Forms.Panel();
            this.toolStripSeparator1 = new ToolStripSeparator();
            this.ClearBtn            = new ToolStripButton();
            this.Splitter.Panel1.SuspendLayout();
            this.Splitter.Panel2.SuspendLayout();
            this.Splitter.SuspendLayout();
            this.BrowserPanel.SuspendLayout();
            this.Toolbar.SuspendLayout();
            this.Panel.SuspendLayout();
            base.SuspendLayout();
            this.OKBtn.Anchor                      = AnchorStyles.Bottom | AnchorStyles.Right;
            this.OKBtn.DialogResult                = System.Windows.Forms.DialogResult.OK;
            this.OKBtn.Location                    = new Point(492, 301);
            this.OKBtn.Name                        = "OKBtn";
            this.OKBtn.Size                        = new System.Drawing.Size(75, 23);
            this.OKBtn.TabIndex                    = 0;
            this.OKBtn.Text                        = "OK";
            this.OKBtn.UseVisualStyleBackColor     = true;
            this.OKBtn.Click                      += new EventHandler(this.OKBtn_Click);
            this.CancelBtn.Anchor                  = AnchorStyles.Bottom | AnchorStyles.Right;
            this.CancelBtn.DialogResult            = System.Windows.Forms.DialogResult.Cancel;
            this.CancelBtn.Location                = new Point(573, 301);
            this.CancelBtn.Name                    = "CancelBtn";
            this.CancelBtn.Size                    = new System.Drawing.Size(75, 23);
            this.CancelBtn.TabIndex                = 1;
            this.CancelBtn.Text                    = "Cancel";
            this.CancelBtn.UseVisualStyleBackColor = true;
            this.Splitter.Dock                     = DockStyle.Fill;
            this.Splitter.FixedPanel               = FixedPanel.Panel1;
            this.Splitter.Location                 = new Point(0, 25);
            this.Splitter.Name                     = "Splitter";
            this.Splitter.Panel1.Controls.Add(this.GoalTree);
            this.Splitter.Panel2.Controls.Add(this.BrowserPanel);
            this.Splitter.Size             = new System.Drawing.Size(636, 258);
            this.Splitter.SplitterDistance = 235;
            this.Splitter.TabIndex         = 2;
            this.GoalTree.AllowDrop        = true;
            this.GoalTree.Dock             = DockStyle.Fill;
            this.GoalTree.Location         = new Point(0, 0);
            this.GoalTree.Name             = "GoalTree";
            this.GoalTree.Size             = new System.Drawing.Size(235, 258);
            this.GoalTree.TabIndex         = 1;
            this.GoalTree.DoubleClick     += new EventHandler(this.EditBtn_Click);
            this.GoalTree.DragDrop        += new DragEventHandler(this.GoalTree_DragDrop);
            this.GoalTree.AfterSelect     += new TreeViewEventHandler(this.GoalTree_AfterSelect);
            this.GoalTree.MouseDown       += new MouseEventHandler(this.GoalTree_MouseDown);
            this.GoalTree.ItemDrag        += new ItemDragEventHandler(this.GoalTree_ItemDrag);
            this.GoalTree.DragOver        += new DragEventHandler(this.GoalTree_DragOver);
            this.BrowserPanel.BorderStyle  = BorderStyle.FixedSingle;
            this.BrowserPanel.Controls.Add(this.Browser);
            this.BrowserPanel.Dock     = DockStyle.Fill;
            this.BrowserPanel.Location = new Point(0, 0);
            this.BrowserPanel.Name     = "BrowserPanel";
            this.BrowserPanel.Size     = new System.Drawing.Size(397, 258);
            this.BrowserPanel.TabIndex = 0;
            this.Browser.Dock          = DockStyle.Fill;
            this.Browser.Location      = new Point(0, 0);
            this.Browser.MinimumSize   = new System.Drawing.Size(20, 20);
            this.Browser.Name          = "Browser";
            this.Browser.Size          = new System.Drawing.Size(395, 256);
            this.Browser.TabIndex      = 0;
            ToolStripItemCollection items = this.Toolbar.Items;

            ToolStripItem[] addBtn = new ToolStripItem[] { this.AddBtn, this.RemoveBtn, this.EditBtn, this.toolStripSeparator1, this.ClearBtn };
            items.AddRange(addBtn);
            this.Toolbar.Location             = new Point(0, 0);
            this.Toolbar.Name                 = "Toolbar";
            this.Toolbar.Size                 = new System.Drawing.Size(636, 25);
            this.Toolbar.TabIndex             = 0;
            this.Toolbar.Text                 = "toolStrip1";
            this.AddBtn.DisplayStyle          = ToolStripItemDisplayStyle.Text;
            this.AddBtn.Image                 = (Image)componentResourceManager.GetObject("AddBtn.Image");
            this.AddBtn.ImageTransparentColor = Color.Magenta;
            this.AddBtn.Name                     = "AddBtn";
            this.AddBtn.Size                     = new System.Drawing.Size(33, 22);
            this.AddBtn.Text                     = "Add";
            this.AddBtn.Click                   += new EventHandler(this.AddBtn_Click);
            this.RemoveBtn.DisplayStyle          = ToolStripItemDisplayStyle.Text;
            this.RemoveBtn.Image                 = (Image)componentResourceManager.GetObject("RemoveBtn.Image");
            this.RemoveBtn.ImageTransparentColor = Color.Magenta;
            this.RemoveBtn.Name                  = "RemoveBtn";
            this.RemoveBtn.Size                  = new System.Drawing.Size(54, 22);
            this.RemoveBtn.Text                  = "Remove";
            this.RemoveBtn.Click                += new EventHandler(this.RemoveBtn_Click);
            this.EditBtn.DisplayStyle            = ToolStripItemDisplayStyle.Text;
            this.EditBtn.Image                   = (Image)componentResourceManager.GetObject("EditBtn.Image");
            this.EditBtn.ImageTransparentColor   = Color.Magenta;
            this.EditBtn.Name                    = "EditBtn";
            this.EditBtn.Size                    = new System.Drawing.Size(31, 22);
            this.EditBtn.Text                    = "Edit";
            this.EditBtn.Click                  += new EventHandler(this.EditBtn_Click);
            this.Panel.Anchor                    = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
            this.Panel.Controls.Add(this.Splitter);
            this.Panel.Controls.Add(this.Toolbar);
            this.Panel.Location                 = new Point(12, 12);
            this.Panel.Name                     = "Panel";
            this.Panel.Size                     = new System.Drawing.Size(636, 283);
            this.Panel.TabIndex                 = 3;
            this.toolStripSeparator1.Name       = "toolStripSeparator1";
            this.toolStripSeparator1.Size       = new System.Drawing.Size(6, 25);
            this.ClearBtn.DisplayStyle          = ToolStripItemDisplayStyle.Text;
            this.ClearBtn.Image                 = (Image)componentResourceManager.GetObject("ClearBtn.Image");
            this.ClearBtn.ImageTransparentColor = Color.Magenta;
            this.ClearBtn.Name                  = "ClearBtn";
            this.ClearBtn.Size                  = new System.Drawing.Size(55, 22);
            this.ClearBtn.Text                  = "Clear All";
            this.ClearBtn.Click                += new EventHandler(this.ClearBtn_Click);
            base.AcceptButton                   = this.OKBtn;
            base.AutoScaleDimensions            = new SizeF(6f, 13f);
            base.AutoScaleMode                  = System.Windows.Forms.AutoScaleMode.Font;
            base.CancelButton                   = this.CancelBtn;
            base.ClientSize                     = new System.Drawing.Size(660, 336);
            base.Controls.Add(this.Panel);
            base.Controls.Add(this.CancelBtn);
            base.Controls.Add(this.OKBtn);
            base.MaximizeBox   = false;
            base.MinimizeBox   = false;
            base.Name          = "GoalListForm";
            base.ShowIcon      = false;
            base.ShowInTaskbar = false;
            base.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
            base.StartPosition = FormStartPosition.CenterParent;
            this.Text          = "Party Goals";
            base.FormClosing  += new FormClosingEventHandler(this.GoalListForm_FormClosing);
            this.Splitter.Panel1.ResumeLayout(false);
            this.Splitter.Panel2.ResumeLayout(false);
            this.Splitter.ResumeLayout(false);
            this.BrowserPanel.ResumeLayout(false);
            this.Toolbar.ResumeLayout(false);
            this.Toolbar.PerformLayout();
            this.Panel.ResumeLayout(false);
            this.Panel.PerformLayout();
            base.ResumeLayout(false);
        }
Пример #10
0
        /// <summary>
        /// Creates and returns a context (right click popup) menu.
        /// Does not raise any events.</summary>
        /// <param name="commandTags">Commands in menu; nulls indicate separators</param>
        /// <returns>ContextMenuStrip for context menu</returns>
        public ContextMenuStrip CreateContextMenu(IEnumerable <object> commandTags)
        {
            ContextMenuStrip contextMenu = new ContextMenuStrip();
            int itemCount;

            foreach (object commandTag in commandTags)
            {
                // check for separator
                if (commandTag == null)
                {
                    itemCount = contextMenu.Items.Count;
                    if (itemCount > 0 &&
                        !(contextMenu.Items[itemCount - 1] is ToolStripSeparator))
                    {
                        contextMenu.Items.Add(new ToolStripSeparator());
                    }
                    continue;
                }

                // add the command and sort it by groups since the last separator
                CommandInfo info = GetCommandInfo(commandTag);
                if (info != null && (info.Visibility & CommandVisibility.ContextMenu) != 0)
                {
                    // allow client to update command appearance
                    UpdateCommand(info);

                    var menuItem = info.GetMenuItem();
                    if (menuItem.Enabled || !ContextMenuAutoCompact)
                    {
                        ToolStripItemCollection commands = BuildSubMenus(contextMenu.Items, info);
                        ToolStripMenuItem       clone    = new ToolStripMenuItem();
                        clone.Text                     = menuItem.Text;
                        clone.Image                    = menuItem.Image;
                        clone.Name                     = menuItem.Name;
                        clone.Enabled                  = menuItem.Enabled;
                        clone.Checked                  = menuItem.Checked;
                        clone.Tag                      = menuItem.Tag;
                        clone.ToolTipText              = menuItem.ToolTipText;
                        clone.ShortcutKeys             = menuItem.ShortcutKeys;
                        clone.ShortcutKeyDisplayString = menuItem.ShortcutKeyDisplayString;
                        clone.Click                   += contextMenu_itemClick;
                        clone.ForeColor                = m_mainMenuStrip.ForeColor;
                        clone.CheckOnClick             = info.CheckOnClick;
                        commands.Add(clone);

                        MaintainSeparateGroups(commands, clone, info.GroupTag);
                    }
                }
            }

            // Remove trailing separator.
            itemCount = contextMenu.Items.Count;
            if (itemCount > 0 &&
                (contextMenu.Items[itemCount - 1] is ToolStripSeparator))
            {
                contextMenu.Items.RemoveAt(itemCount - 1);
            }

            SkinService.ApplyActiveSkin(contextMenu);

            return(contextMenu);
        }
Пример #11
0
        public void CreateCopy(ToolStripItemCollection tsicTarget,
                               ToolStripItem tsiPosRef, bool bAfter, ToolStripMenuItem tsmiBase)
        {
            if (tsicTarget == null)
            {
                Debug.Assert(false); return;
            }
            if (tsmiBase == null)
            {
                Debug.Assert(false); return;
            }

            ToolStripMenuItem tsmi = new ToolStripMenuItem();

            string strName = tsmiBase.Name, strNameNew = null;

            if (!string.IsNullOrEmpty(strName))
            {
                if (strName.StartsWith("m_menu", StrUtil.CaseIgnoreCmp))
                {
                    strNameNew = "m_ctx" + strName.Substring(6);
                }
            }
            if (!string.IsNullOrEmpty(strNameNew))
            {
                ToolStripItem[] v = tsicTarget.Find(strNameNew, true);
                if ((v == null) || (v.Length == 0))
                {
                    tsmi.Name = strNameNew;
                }
                else
                {
                    Debug.Assert(false);
                }
            }
            else
            {
                Debug.Assert(false);
            }

            CreateLink(tsmi, tsmiBase, (tsmiBase.DropDownItems.Count == 0));

            int i, n = tsicTarget.Count;

            if (tsiPosRef == null)
            {
                i = (bAfter ? n : 0);
            }
            else
            {
                i = tsicTarget.IndexOf(tsiPosRef);
                if (i < 0)
                {
                    Debug.Assert(false); i = n;
                }
                else if (bAfter)
                {
                    ++i;
                }
            }

            tsicTarget.Insert(i, tsmi);

            foreach (ToolStripItem tsiSub in tsmiBase.DropDownItems)
            {
                ToolStripMenuItem tsmiSub = (tsiSub as ToolStripMenuItem);
                if (tsmiSub != null)
                {
                    CreateCopy(tsmi.DropDownItems, null, true, tsmiSub);
                }
                else if (tsiSub is ToolStripSeparator)
                {
                    tsmi.DropDownItems.Add(new ToolStripSeparator());
                }
                else
                {
                    Debug.Assert(false);
                }
            }
        }
Пример #12
0
        private void InitializeComponent()
        {
            ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(MapAreaForm));

            this.NameLbl        = new Label();
            this.NameBox        = new TextBox();
            this.OKBtn          = new Button();
            this.CancelBtn      = new Button();
            this.Pages          = new TabControl();
            this.DetailsPage    = new TabPage();
            this.DetailsBox     = new TextBox();
            this.DetailsToolbar = new ToolStrip();
            this.RandomDescBtn  = new ToolStripButton();
            this.MovePage       = new TabPage();
            this.MoveTable      = new TableLayoutPanel();
            this.MoveUpBtn      = new Button();
            this.MoveDownBtn    = new Button();
            this.MoveLeftBtn    = new Button();
            this.MoveRightBtn   = new Button();
            this.ResizePage     = new TabPage();
            this.ResizeTable    = new TableLayoutPanel();
            this.TopMoreBtn     = new Button();
            this.TopLessBtn     = new Button();
            this.LeftMoreBtn    = new Button();
            this.LeftLessBtn    = new Button();
            this.RightLessBtn   = new Button();
            this.RightMoreBtn   = new Button();
            this.BottomLessBtn  = new Button();
            this.BottomMoreBtn  = new Button();
            this.MapView        = new Masterplan.Controls.MapView();
            this.RandomNameBtn  = new ToolStripButton();
            this.Pages.SuspendLayout();
            this.DetailsPage.SuspendLayout();
            this.DetailsToolbar.SuspendLayout();
            this.MovePage.SuspendLayout();
            this.MoveTable.SuspendLayout();
            this.ResizePage.SuspendLayout();
            this.ResizeTable.SuspendLayout();
            base.SuspendLayout();
            this.NameLbl.AutoSize                  = true;
            this.NameLbl.Location                  = new Point(12, 15);
            this.NameLbl.Name                      = "NameLbl";
            this.NameLbl.Size                      = new System.Drawing.Size(38, 13);
            this.NameLbl.TabIndex                  = 0;
            this.NameLbl.Text                      = "Name:";
            this.NameBox.Anchor                    = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            this.NameBox.Location                  = new Point(56, 12);
            this.NameBox.Name                      = "NameBox";
            this.NameBox.Size                      = new System.Drawing.Size(343, 20);
            this.NameBox.TabIndex                  = 1;
            this.OKBtn.Anchor                      = AnchorStyles.Bottom | AnchorStyles.Right;
            this.OKBtn.DialogResult                = System.Windows.Forms.DialogResult.OK;
            this.OKBtn.Location                    = new Point(594, 382);
            this.OKBtn.Name                        = "OKBtn";
            this.OKBtn.Size                        = new System.Drawing.Size(75, 23);
            this.OKBtn.TabIndex                    = 4;
            this.OKBtn.Text                        = "OK";
            this.OKBtn.UseVisualStyleBackColor     = true;
            this.OKBtn.Click                      += new EventHandler(this.OKBtn_Click);
            this.CancelBtn.Anchor                  = AnchorStyles.Bottom | AnchorStyles.Right;
            this.CancelBtn.DialogResult            = System.Windows.Forms.DialogResult.Cancel;
            this.CancelBtn.Location                = new Point(675, 382);
            this.CancelBtn.Name                    = "CancelBtn";
            this.CancelBtn.Size                    = new System.Drawing.Size(75, 23);
            this.CancelBtn.TabIndex                = 5;
            this.CancelBtn.Text                    = "Cancel";
            this.CancelBtn.UseVisualStyleBackColor = true;
            this.Pages.Anchor                      = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
            this.Pages.Controls.Add(this.DetailsPage);
            this.Pages.Controls.Add(this.MovePage);
            this.Pages.Controls.Add(this.ResizePage);
            this.Pages.Location      = new Point(12, 38);
            this.Pages.Name          = "Pages";
            this.Pages.SelectedIndex = 0;
            this.Pages.Size          = new System.Drawing.Size(387, 338);
            this.Pages.TabIndex      = 6;
            this.DetailsPage.Controls.Add(this.DetailsBox);
            this.DetailsPage.Controls.Add(this.DetailsToolbar);
            this.DetailsPage.Location = new Point(4, 22);
            this.DetailsPage.Name     = "DetailsPage";
            this.DetailsPage.Padding  = new System.Windows.Forms.Padding(3);
            this.DetailsPage.Size     = new System.Drawing.Size(379, 312);
            this.DetailsPage.TabIndex = 0;
            this.DetailsPage.Text     = "Details";
            this.DetailsPage.UseVisualStyleBackColor = true;
            this.DetailsBox.AcceptsReturn            = true;
            this.DetailsBox.AcceptsTab = true;
            this.DetailsBox.Dock       = DockStyle.Fill;
            this.DetailsBox.Location   = new Point(3, 28);
            this.DetailsBox.Multiline  = true;
            this.DetailsBox.Name       = "DetailsBox";
            this.DetailsBox.ScrollBars = ScrollBars.Vertical;
            this.DetailsBox.Size       = new System.Drawing.Size(373, 281);
            this.DetailsBox.TabIndex   = 0;
            ToolStripItemCollection items = this.DetailsToolbar.Items;

            ToolStripItem[] randomNameBtn = new ToolStripItem[] { this.RandomNameBtn, this.RandomDescBtn };
            items.AddRange(randomNameBtn);
            this.DetailsToolbar.Location             = new Point(3, 3);
            this.DetailsToolbar.Name                 = "DetailsToolbar";
            this.DetailsToolbar.Size                 = new System.Drawing.Size(373, 25);
            this.DetailsToolbar.TabIndex             = 1;
            this.DetailsToolbar.Text                 = "toolStrip1";
            this.RandomDescBtn.DisplayStyle          = ToolStripItemDisplayStyle.Text;
            this.RandomDescBtn.Image                 = (Image)componentResourceManager.GetObject("RandomDescBtn.Image");
            this.RandomDescBtn.ImageTransparentColor = Color.Magenta;
            this.RandomDescBtn.Name   = "RandomDescBtn";
            this.RandomDescBtn.Size   = new System.Drawing.Size(119, 22);
            this.RandomDescBtn.Text   = "Random Description";
            this.RandomDescBtn.Click += new EventHandler(this.RandomDescBtn_Click);
            this.MovePage.Controls.Add(this.MoveTable);
            this.MovePage.Location = new Point(4, 22);
            this.MovePage.Name     = "MovePage";
            this.MovePage.Padding  = new System.Windows.Forms.Padding(3);
            this.MovePage.Size     = new System.Drawing.Size(379, 312);
            this.MovePage.TabIndex = 2;
            this.MovePage.Text     = "Move";
            this.MovePage.UseVisualStyleBackColor = true;
            this.MoveTable.ColumnCount            = 3;
            this.MoveTable.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33f));
            this.MoveTable.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 34f));
            this.MoveTable.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33f));
            this.MoveTable.Controls.Add(this.MoveUpBtn, 1, 0);
            this.MoveTable.Controls.Add(this.MoveDownBtn, 1, 2);
            this.MoveTable.Controls.Add(this.MoveLeftBtn, 0, 1);
            this.MoveTable.Controls.Add(this.MoveRightBtn, 2, 1);
            this.MoveTable.Dock     = DockStyle.Fill;
            this.MoveTable.Location = new Point(3, 3);
            this.MoveTable.Name     = "MoveTable";
            this.MoveTable.RowCount = 3;
            this.MoveTable.RowStyles.Add(new RowStyle(SizeType.Percent, 33f));
            this.MoveTable.RowStyles.Add(new RowStyle(SizeType.Percent, 34f));
            this.MoveTable.RowStyles.Add(new RowStyle(SizeType.Percent, 33f));
            this.MoveTable.Size     = new System.Drawing.Size(373, 306);
            this.MoveTable.TabIndex = 0;
            this.MoveUpBtn.Dock     = DockStyle.Fill;
            this.MoveUpBtn.Location = new Point(126, 3);
            this.MoveUpBtn.Name     = "MoveUpBtn";
            this.MoveUpBtn.Size     = new System.Drawing.Size(120, 94);
            this.MoveUpBtn.TabIndex = 0;
            this.MoveUpBtn.Text     = "Up";
            this.MoveUpBtn.UseVisualStyleBackColor = true;
            this.MoveUpBtn.Click     += new EventHandler(this.MoveUpBtn_Click);
            this.MoveDownBtn.Dock     = DockStyle.Fill;
            this.MoveDownBtn.Location = new Point(126, 207);
            this.MoveDownBtn.Name     = "MoveDownBtn";
            this.MoveDownBtn.Size     = new System.Drawing.Size(120, 96);
            this.MoveDownBtn.TabIndex = 3;
            this.MoveDownBtn.Text     = "Down";
            this.MoveDownBtn.UseVisualStyleBackColor = true;
            this.MoveDownBtn.Click   += new EventHandler(this.MoveDownBtn_Click);
            this.MoveLeftBtn.Dock     = DockStyle.Fill;
            this.MoveLeftBtn.Location = new Point(3, 103);
            this.MoveLeftBtn.Name     = "MoveLeftBtn";
            this.MoveLeftBtn.Size     = new System.Drawing.Size(117, 98);
            this.MoveLeftBtn.TabIndex = 1;
            this.MoveLeftBtn.Text     = "Left";
            this.MoveLeftBtn.UseVisualStyleBackColor = true;
            this.MoveLeftBtn.Click    += new EventHandler(this.MoveLeftBtn_Click);
            this.MoveRightBtn.Dock     = DockStyle.Fill;
            this.MoveRightBtn.Location = new Point(252, 103);
            this.MoveRightBtn.Name     = "MoveRightBtn";
            this.MoveRightBtn.Size     = new System.Drawing.Size(118, 98);
            this.MoveRightBtn.TabIndex = 2;
            this.MoveRightBtn.Text     = "Right";
            this.MoveRightBtn.UseVisualStyleBackColor = true;
            this.MoveRightBtn.Click += new EventHandler(this.MoveRightBtn_Click);
            this.ResizePage.Controls.Add(this.ResizeTable);
            this.ResizePage.Location = new Point(4, 22);
            this.ResizePage.Name     = "ResizePage";
            this.ResizePage.Padding  = new System.Windows.Forms.Padding(3);
            this.ResizePage.Size     = new System.Drawing.Size(391, 312);
            this.ResizePage.TabIndex = 1;
            this.ResizePage.Text     = "Resize";
            this.ResizePage.UseVisualStyleBackColor = true;
            this.ResizeTable.ColumnCount            = 4;
            this.ResizeTable.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20f));
            this.ResizeTable.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20f));
            this.ResizeTable.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20f));
            this.ResizeTable.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20f));
            this.ResizeTable.Controls.Add(this.TopMoreBtn, 1, 0);
            this.ResizeTable.Controls.Add(this.TopLessBtn, 2, 0);
            this.ResizeTable.Controls.Add(this.LeftMoreBtn, 0, 1);
            this.ResizeTable.Controls.Add(this.LeftLessBtn, 0, 2);
            this.ResizeTable.Controls.Add(this.RightLessBtn, 3, 2);
            this.ResizeTable.Controls.Add(this.RightMoreBtn, 3, 1);
            this.ResizeTable.Controls.Add(this.BottomLessBtn, 2, 3);
            this.ResizeTable.Controls.Add(this.BottomMoreBtn, 1, 3);
            this.ResizeTable.Dock     = DockStyle.Fill;
            this.ResizeTable.Location = new Point(3, 3);
            this.ResizeTable.Name     = "ResizeTable";
            this.ResizeTable.RowCount = 4;
            this.ResizeTable.RowStyles.Add(new RowStyle(SizeType.Percent, 20f));
            this.ResizeTable.RowStyles.Add(new RowStyle(SizeType.Percent, 20f));
            this.ResizeTable.RowStyles.Add(new RowStyle(SizeType.Percent, 20f));
            this.ResizeTable.RowStyles.Add(new RowStyle(SizeType.Percent, 20f));
            this.ResizeTable.Size     = new System.Drawing.Size(385, 306);
            this.ResizeTable.TabIndex = 0;
            this.TopMoreBtn.Dock      = DockStyle.Fill;
            this.TopMoreBtn.Location  = new Point(99, 3);
            this.TopMoreBtn.Name      = "TopMoreBtn";
            this.TopMoreBtn.Size      = new System.Drawing.Size(90, 70);
            this.TopMoreBtn.TabIndex  = 0;
            this.TopMoreBtn.Text      = "More";
            this.TopMoreBtn.UseVisualStyleBackColor = true;
            this.TopMoreBtn.Click   += new EventHandler(this.TopMoreBtn_Click);
            this.TopLessBtn.Dock     = DockStyle.Fill;
            this.TopLessBtn.Location = new Point(195, 3);
            this.TopLessBtn.Name     = "TopLessBtn";
            this.TopLessBtn.Size     = new System.Drawing.Size(90, 70);
            this.TopLessBtn.TabIndex = 1;
            this.TopLessBtn.Text     = "Less";
            this.TopLessBtn.UseVisualStyleBackColor = true;
            this.TopLessBtn.Click    += new EventHandler(this.TopLessBtn_Click);
            this.LeftMoreBtn.Dock     = DockStyle.Fill;
            this.LeftMoreBtn.Location = new Point(3, 79);
            this.LeftMoreBtn.Name     = "LeftMoreBtn";
            this.LeftMoreBtn.Size     = new System.Drawing.Size(90, 70);
            this.LeftMoreBtn.TabIndex = 2;
            this.LeftMoreBtn.Text     = "More";
            this.LeftMoreBtn.UseVisualStyleBackColor = true;
            this.LeftMoreBtn.Click   += new EventHandler(this.LeftMoreBtn_Click);
            this.LeftLessBtn.Dock     = DockStyle.Fill;
            this.LeftLessBtn.Location = new Point(3, 155);
            this.LeftLessBtn.Name     = "LeftLessBtn";
            this.LeftLessBtn.Size     = new System.Drawing.Size(90, 70);
            this.LeftLessBtn.TabIndex = 3;
            this.LeftLessBtn.Text     = "Less";
            this.LeftLessBtn.UseVisualStyleBackColor = true;
            this.LeftLessBtn.Click    += new EventHandler(this.LeftLessBtn_Click);
            this.RightLessBtn.Dock     = DockStyle.Fill;
            this.RightLessBtn.Location = new Point(291, 155);
            this.RightLessBtn.Name     = "RightLessBtn";
            this.RightLessBtn.Size     = new System.Drawing.Size(91, 70);
            this.RightLessBtn.TabIndex = 4;
            this.RightLessBtn.Text     = "Less";
            this.RightLessBtn.UseVisualStyleBackColor = true;
            this.RightLessBtn.Click   += new EventHandler(this.RightLessBtn_Click);
            this.RightMoreBtn.Dock     = DockStyle.Fill;
            this.RightMoreBtn.Location = new Point(291, 79);
            this.RightMoreBtn.Name     = "RightMoreBtn";
            this.RightMoreBtn.Size     = new System.Drawing.Size(91, 70);
            this.RightMoreBtn.TabIndex = 5;
            this.RightMoreBtn.Text     = "More";
            this.RightMoreBtn.UseVisualStyleBackColor = true;
            this.RightMoreBtn.Click    += new EventHandler(this.RightMoreBtn_Click);
            this.BottomLessBtn.Dock     = DockStyle.Fill;
            this.BottomLessBtn.Location = new Point(195, 231);
            this.BottomLessBtn.Name     = "BottomLessBtn";
            this.BottomLessBtn.Size     = new System.Drawing.Size(90, 72);
            this.BottomLessBtn.TabIndex = 6;
            this.BottomLessBtn.Text     = "Less";
            this.BottomLessBtn.UseVisualStyleBackColor = true;
            this.BottomLessBtn.Click   += new EventHandler(this.BottomLessBtn_Click);
            this.BottomMoreBtn.Dock     = DockStyle.Fill;
            this.BottomMoreBtn.Location = new Point(99, 231);
            this.BottomMoreBtn.Name     = "BottomMoreBtn";
            this.BottomMoreBtn.Size     = new System.Drawing.Size(90, 72);
            this.BottomMoreBtn.TabIndex = 7;
            this.BottomMoreBtn.Text     = "More";
            this.BottomMoreBtn.UseVisualStyleBackColor = true;
            this.BottomMoreBtn.Click      += new EventHandler(this.BottomMoreBtn_Click);
            this.MapView.AllowDrawing      = false;
            this.MapView.AllowDrop         = true;
            this.MapView.AllowLinkCreation = false;
            this.MapView.AllowScrolling    = false;
            this.MapView.Anchor            = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right;
            this.MapView.BackgroundMap     = null;
            this.MapView.BorderSize        = 0;
            this.MapView.BorderStyle       = BorderStyle.FixedSingle;
            this.MapView.Cursor            = Cursors.Default;
            this.MapView.Encounter         = null;
            this.MapView.FrameType         = MapDisplayType.Dimmed;
            this.MapView.HighlightAreas    = false;
            this.MapView.HoverToken        = null;
            this.MapView.LineOfSight       = false;
            this.MapView.Location          = new Point(405, 12);
            this.MapView.Map                         = null;
            this.MapView.Mode                        = MapViewMode.Thumbnail;
            this.MapView.Name                        = "MapView";
            this.MapView.ScalingFactor               = 1;
            this.MapView.SelectedArea                = null;
            this.MapView.SelectedTiles               = null;
            this.MapView.Selection                   = new Rectangle(0, 0, 0, 0);
            this.MapView.ShowAuras                   = true;
            this.MapView.ShowConditions              = true;
            this.MapView.ShowCreatureLabels          = true;
            this.MapView.ShowCreatures               = CreatureViewMode.All;
            this.MapView.ShowGrid                    = MapGridMode.None;
            this.MapView.ShowGridLabels              = false;
            this.MapView.ShowHealthBars              = false;
            this.MapView.ShowPictureTokens           = true;
            this.MapView.Size                        = new System.Drawing.Size(345, 364);
            this.MapView.TabIndex                    = 3;
            this.MapView.Tactical                    = false;
            this.MapView.TokenLinks                  = null;
            this.MapView.Viewpoint                   = new Rectangle(0, 0, 0, 0);
            this.RandomNameBtn.DisplayStyle          = ToolStripItemDisplayStyle.Text;
            this.RandomNameBtn.Image                 = (Image)componentResourceManager.GetObject("RandomNameBtn.Image");
            this.RandomNameBtn.ImageTransparentColor = Color.Magenta;
            this.RandomNameBtn.Name                  = "RandomNameBtn";
            this.RandomNameBtn.Size                  = new System.Drawing.Size(91, 22);
            this.RandomNameBtn.Text                  = "Random Name";
            this.RandomNameBtn.Click                += new EventHandler(this.RandomNameBtn_Click);
            base.AcceptButton                        = this.OKBtn;
            base.AutoScaleDimensions                 = new SizeF(6f, 13f);
            base.AutoScaleMode                       = System.Windows.Forms.AutoScaleMode.Font;
            base.CancelButton                        = this.CancelBtn;
            base.ClientSize = new System.Drawing.Size(762, 417);
            base.Controls.Add(this.Pages);
            base.Controls.Add(this.MapView);
            base.Controls.Add(this.CancelBtn);
            base.Controls.Add(this.OKBtn);
            base.Controls.Add(this.NameBox);
            base.Controls.Add(this.NameLbl);
            base.MaximizeBox   = false;
            base.MinimizeBox   = false;
            base.Name          = "MapAreaForm";
            base.ShowIcon      = false;
            base.ShowInTaskbar = false;
            base.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
            base.StartPosition = FormStartPosition.CenterParent;
            this.Text          = "Map Area";
            this.Pages.ResumeLayout(false);
            this.DetailsPage.ResumeLayout(false);
            this.DetailsPage.PerformLayout();
            this.DetailsToolbar.ResumeLayout(false);
            this.DetailsToolbar.PerformLayout();
            this.MovePage.ResumeLayout(false);
            this.MoveTable.ResumeLayout(false);
            this.ResizePage.ResumeLayout(false);
            this.ResizeTable.ResumeLayout(false);
            base.ResumeLayout(false);
            base.PerformLayout();
        }
        /// <summary>
        /// Add our menu items out to the display
        /// </summary>
        /// <param name="ItemCollection"></param>
        public void AddMenuItems(ToolStripItemCollection ItemCollection)
        {
            int EqualWidth = 0, FieldWidth = 0;

            //Measure the names of our substations
            Dictionary <String, String[]> NameReplacements = new Dictionary <string, string[]>();
            Random r = new Random();

            foreach (String str in Headers.Keys)
            {
                int    ThisWidth = TextRenderer.MeasureText(" " + str + " ", ParentMenu.Font).Width;
                String OutStr    = str;
                while (ThisWidth > 80)
                {
                    char[]     OutChars = OutStr.ToCharArray();
                    List <int> Spaces   = new List <int>();
                    for (int a = 0; a < OutChars.Length; a++)
                    {
                        if (OutChars[a] == ' ')
                        {
                            Spaces.Add(a);
                        }
                    }
                    if (Spaces.Count == 0)
                    {
                        break;
                    }
                    OutChars[Spaces[r.Next(0, Spaces.Count)]] = '\n';
                    OutStr    = new string(OutChars);
                    ThisWidth = TextRenderer.MeasureText(OutStr, ParentMenu.Font).Width;
                }
                NameReplacements.Add(str, OutStr.Split('\n'));
                EqualWidth = Math.Max(EqualWidth, ThisWidth);
            }

            //Determine the names of our fields, and values
            foreach (String str in Fields.Keys)
            {
                FieldWidth = Math.Max(FieldWidth, TextRenderer.MeasureText(str + ": ", ParentMenu.Font).Width);
            }
            if (ShowEstimates)
            {
                foreach (String str in EstValues.Values)
                {
                    EqualWidth = Math.Max(EqualWidth, TextRenderer.MeasureText(" " + str + " ", ParentMenu.Font).Width);
                }
            }
            if (ShowTelemetry)
            {
                foreach (String str in TelemValues.Values)
                {
                    EqualWidth = Math.Max(EqualWidth, TextRenderer.MeasureText(" " + str + " ", ParentMenu.Font).Width);
                }
            }

            //Write out our header first
            StringBuilder sB = new StringBuilder();



            //Pull in our strings for each header
            List <String[]> HeaderRows = new List <string[]>();
            int             MaxLines   = 0;

            foreach (string[] str in NameReplacements.Values)
            {
                HeaderRows.Add(str);
                MaxLines = Math.Max(MaxLines, str.Length);
            }

            //Now, add in our Est and Telem values
            sB.Append(GetString("", FieldWidth));
            if (ShowEstimates) // we might have estimates, but we just don't want the user to have a nice header unless some config is set somewhere.
            {
                if (TextRenderer.MeasureText("Estimated", ParentMenu.Font).Width > EqualWidth * Headers.Count)
                {
                    sB.Append(GetString("Est.", EqualWidth * Headers.Count));
                }
                else
                {
                    sB.Append(GetString("Estimated", EqualWidth * Headers.Count));
                }
            }
            if (ShowTelemetry)
            {
                if (TextRenderer.MeasureText("Telemetered", ParentMenu.Font).Width > EqualWidth * Headers.Count)
                {
                    sB.Append(GetString("Tel.", EqualWidth * Headers.Count));
                }
                else
                {
                    sB.Append(GetString("Telemetered", EqualWidth * Headers.Count));
                }
            }
            sB.AppendLine();


            //For each line, write out the space, then the text
            if (Headers.Count > 1)
            {
                for (int CurRow = 0; CurRow < MaxLines; CurRow++)
                {
                    sB.Append(GetString("", FieldWidth));
                    foreach (String[] str in HeaderRows)
                    {
                        if (CurRow < str.Length)
                        {
                            sB.Append(GetString(str[CurRow], EqualWidth));
                        }
                        else
                        {
                            sB.Append(GetString("", EqualWidth));
                        }
                    }
                    foreach (String[] str in HeaderRows)
                    {
                        if (CurRow < str.Length)
                        {
                            sB.Append(GetString(str[CurRow], EqualWidth));
                        }
                        else
                        {
                            sB.Append(GetString("", EqualWidth));
                        }
                    }
                    sB.AppendLine();
                }
            }

            //Now, write out our values
            foreach (KeyValuePair <String, int> kvp in Fields)
            {
                int LeftWidth = FieldWidth - TextRenderer.MeasureText(kvp.Key, ParentMenu.Font).Width;
                sB.Append(kvp.Key + ":" + new String(' ', GetSpaces(LeftWidth)));
                foreach (KeyValuePair <Point, String> kvp2 in EstValues)
                {
                    if (kvp2.Key.Y == kvp.Value)
                    {
                        sB.Append(GetString(kvp2.Value, EqualWidth));
                    }
                }
                foreach (KeyValuePair <Point, String> kvp2 in TelemValues)
                {
                    if (kvp2.Key.Y == kvp.Value)
                    {
                        sB.Append(GetString(kvp2.Value, EqualWidth));
                    }
                }
                sB.AppendLine();
            }

            String ThisLine;

            using (System.IO.StringReader sRd = new System.IO.StringReader(sB.ToString()))
                while (!String.IsNullOrEmpty(ThisLine = sRd.ReadLine()))
                {
                    ItemCollection.Add(ThisLine).Enabled = false;
                }
        }
Пример #14
0
        public int SetStatusForToolStripItems(ToolStripItemCollection items)
        {
            var ms = new MenuStatusSetter(subMenu_Popup, item_Click);

            return(ms.SetStatus(new ToolStripItemAdapter(items), target));
        }
        /// <summary>
        /// Builds a native context menu, on to the provided HMENU.
        /// </summary>
        /// <param name="hMenu">The handle to the menu.</param>
        /// <param name="itemIndex">The zero-based position at which to insert the first new menu item.</param>
        /// <param name="firstItemId">The first item id.</param>
        /// <param name="toolStripItems">The tool strip menu items.</param>
        /// <returns>The index of the last item created.</returns>
        public uint BuildNativeContextMenu(IntPtr hMenu, uint itemIndex, uint firstItemId, ToolStripItemCollection toolStripItems)
        {
            //  Create an ID counter and position counter. The position is provided by the caller. If this is a top level menu item (i.e.
            //  top level in the shell context menu) then 'position' will be provided by the Shell via an earlier call to IContextMenu::QueryContextMenu.
            //  When we create submenus, we simply start at position '0'.
            var idCounter       = firstItemId;
            var positionCounter = itemIndex;

            //  Go through every tool strip item.
            foreach (ToolStripItem item in toolStripItems)
            {
                //  If there's not a name, set one.
                //  This will be used as the verb.
                if (string.IsNullOrEmpty(item.Name))
                {
                    item.Name = Guid.NewGuid().ToString();
                }

                //  Map the command by verb and id.
                verbsToCommands[item.Name] = item;
                idsToItems[idCounter]      = item;

                //  Create the native menu item info.
                var menuItemInfo = CreateNativeMenuItem(item, idCounter);

                //  Insert the native menu item.
                if (User32.InsertMenuItem(hMenu, positionCounter, true, ref menuItemInfo) == false)
                {
                    //  We failed to build the item, so don't try and do anything more with it.
                    continue;
                }

                //  We successfully created the menu item, so increment the position and ID counters.
                indexedCommands.Add(item);
                idCounter++;
                positionCounter++;

                //  Have we just built a menu item? If so, does it have child items?
                if (item is ToolStripMenuItem toolStripMenuItem && toolStripMenuItem.HasDropDownItems)
                {
                    //  Create the drop down menu. As this is a submenu, we start at position zero and go from there.
                    idCounter = BuildNativeContextMenu(menuItemInfo.hSubMenu, 0, idCounter, toolStripMenuItem.DropDownItems);
                }
            }

            //  Return the counter.
            return(idCounter);
        }
Пример #16
0
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));

            this.progressBar1             = new ProgressBar();
            this.menuStrip1               = new MenuStrip();
            this.fileToolStripMenuItem    = new ToolStripMenuItem();
            this.startToolStripMenuItem   = new ToolStripMenuItem();
            this.optionsToolStripMenuItem = new ToolStripMenuItem();
            this.exitToolStripMenuItem    = new ToolStripMenuItem();
            this.helpToolStripMenuItem    = new ToolStripMenuItem();
            this.aboutToolStripMenuItem   = new ToolStripMenuItem();
            this.progressBar2             = new ProgressBar();
            this.label1            = new Label();
            this.label2            = new Label();
            this.textBox1          = new TextBox();
            this.label3            = new Label();
            this.backgroundWorker1 = new BackgroundWorker();
            this.menuStrip1.SuspendLayout();
            base.SuspendLayout();
            this.progressBar1.Location = new Point(12, 195);
            this.progressBar1.Name     = "progressBar1";
            this.progressBar1.Size     = new System.Drawing.Size(375, 23);
            this.progressBar1.TabIndex = 0;
            ToolStripItemCollection items = this.menuStrip1.Items;

            ToolStripItem[] toolStripItemArray = new ToolStripItem[] { this.fileToolStripMenuItem, this.helpToolStripMenuItem };
            items.AddRange(toolStripItemArray);
            this.menuStrip1.Location = new Point(0, 0);
            this.menuStrip1.Name     = "menuStrip1";
            this.menuStrip1.Size     = new System.Drawing.Size(399, 24);
            this.menuStrip1.TabIndex = 3;
            this.menuStrip1.Text     = "menuStrip1";
            ToolStripItemCollection dropDownItems = this.fileToolStripMenuItem.DropDownItems;

            toolStripItemArray = new ToolStripItem[] { this.startToolStripMenuItem, this.optionsToolStripMenuItem, this.exitToolStripMenuItem };
            dropDownItems.AddRange(toolStripItemArray);
            this.fileToolStripMenuItem.Name      = "fileToolStripMenuItem";
            this.fileToolStripMenuItem.Size      = new System.Drawing.Size(35, 20);
            this.fileToolStripMenuItem.Text      = "File";
            this.startToolStripMenuItem.Name     = "startToolStripMenuItem";
            this.startToolStripMenuItem.Size     = new System.Drawing.Size(122, 22);
            this.startToolStripMenuItem.Text     = "Start";
            this.startToolStripMenuItem.Click   += new EventHandler(this.startToolStripMenuItem_Click);
            this.optionsToolStripMenuItem.Name   = "optionsToolStripMenuItem";
            this.optionsToolStripMenuItem.Size   = new System.Drawing.Size(122, 22);
            this.optionsToolStripMenuItem.Text   = "Options";
            this.optionsToolStripMenuItem.Click += new EventHandler(this.optionsToolStripMenuItem_Click);
            this.exitToolStripMenuItem.Name      = "exitToolStripMenuItem";
            this.exitToolStripMenuItem.Size      = new System.Drawing.Size(122, 22);
            this.exitToolStripMenuItem.Text      = "Exit";
            this.exitToolStripMenuItem.Click    += new EventHandler(this.exitToolStripMenuItem_Click);
            ToolStripItemCollection ToolStripItemCollection = this.helpToolStripMenuItem.DropDownItems;

            toolStripItemArray = new ToolStripItem[] { this.aboutToolStripMenuItem };
            ToolStripItemCollection.AddRange(toolStripItemArray);
            this.helpToolStripMenuItem.Name    = "helpToolStripMenuItem";
            this.helpToolStripMenuItem.Size    = new System.Drawing.Size(40, 20);
            this.helpToolStripMenuItem.Text    = "Help";
            this.aboutToolStripMenuItem.Name   = "aboutToolStripMenuItem";
            this.aboutToolStripMenuItem.Size   = new System.Drawing.Size(114, 22);
            this.aboutToolStripMenuItem.Text   = "About";
            this.aboutToolStripMenuItem.Click += new EventHandler(this.aboutToolStripMenuItem_Click);
            this.progressBar2.Location         = new Point(12, 126);
            this.progressBar2.Name             = "progressBar2";
            this.progressBar2.Size             = new System.Drawing.Size(374, 23);
            this.progressBar2.TabIndex         = 5;
            this.label1.AutoSize   = true;
            this.label1.Location   = new Point(9, 110);
            this.label1.Name       = "label1";
            this.label1.Size       = new System.Drawing.Size(111, 13);
            this.label1.TabIndex   = 6;
            this.label1.Text       = "Table / View progress";
            this.label2.AutoSize   = true;
            this.label2.Location   = new Point(12, 179);
            this.label2.Name       = "label2";
            this.label2.Size       = new System.Drawing.Size(84, 13);
            this.label2.TabIndex   = 7;
            this.label2.Text       = "Overall Progress";
            this.textBox1.Location = new Point(12, 62);
            this.textBox1.Name     = "textBox1";
            this.textBox1.ReadOnly = true;
            this.textBox1.Size     = new System.Drawing.Size(374, 20);
            this.textBox1.TabIndex = 8;
            this.label3.AutoSize   = true;
            this.label3.Location   = new Point(12, 46);
            this.label3.Name       = "label3";
            this.label3.Size       = new System.Drawing.Size(100, 13);
            this.label3.TabIndex   = 9;
            this.label3.Text       = "Current table / view";
            this.backgroundWorker1.WorkerReportsProgress      = true;
            this.backgroundWorker1.WorkerSupportsCancellation = true;
            this.backgroundWorker1.DoWork             += new DoWorkEventHandler(this.backgroundWorker1_DoWork);
            this.backgroundWorker1.RunWorkerCompleted += new RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted);
            this.backgroundWorker1.ProgressChanged    += new ProgressChangedEventHandler(this.backgroundWorker1_ProgressChanged);
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
            base.ClientSize          = new System.Drawing.Size(399, 250);
            base.Controls.Add(this.label3);
            base.Controls.Add(this.textBox1);
            base.Controls.Add(this.label2);
            base.Controls.Add(this.label1);
            base.Controls.Add(this.progressBar2);
            base.Controls.Add(this.progressBar1);
            base.Controls.Add(this.menuStrip1);
            base.MainMenuStrip = this.menuStrip1;
            this.MaximumSize   = new System.Drawing.Size(407, 277);
            this.MinimumSize   = new System.Drawing.Size(407, 277);
            base.Name          = "Form1";
            this.Icon          = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Text          = "ODBC Data Exporter";
            base.Load         += new EventHandler(this.Form1_Load);
            this.menuStrip1.ResumeLayout(false);
            this.menuStrip1.PerformLayout();
            base.ResumeLayout(false);
            base.PerformLayout();
        }
Пример #17
0
 public static void AddItemsToMenu(ToolStripItemCollection collection, object owner, string addInTreePath)
 {
 }
Пример #18
0
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            ComponentResourceManager componentResourceManager               = new ComponentResourceManager(typeof(MdiForm));
            DockPanelSkin            dockPanelSkin                          = new DockPanelSkin();
            AutoHideStripSkin        autoHideStripSkin                      = new AutoHideStripSkin();
            DockPanelGradient        dockPanelGradient                      = new DockPanelGradient();
            TabGradient                     tabGradient                     = new TabGradient();
            DockPaneStripSkin               dockPaneStripSkin               = new DockPaneStripSkin();
            DockPaneStripGradient           dockPaneStripGradient           = new DockPaneStripGradient();
            TabGradient                     controlLightLight               = new TabGradient();
            DockPanelGradient               control                         = new DockPanelGradient();
            TabGradient                     controlLight                    = new TabGradient();
            DockPaneStripToolWindowGradient dockPaneStripToolWindowGradient = new DockPaneStripToolWindowGradient();
            TabGradient                     activeCaption                   = new TabGradient();
            TabGradient                     controlText                     = new TabGradient();
            DockPanelGradient               dockPanelGradient1              = new DockPanelGradient();
            TabGradient                     gradientInactiveCaption         = new TabGradient();
            TabGradient                     transparent                     = new TabGradient();

            this.MainMenu               = new MenuStrip();
            this.MainMenu.Font          = new System.Drawing.Font(Localization.Font, 9f, FontStyle.Bold, GraphicsUnit.Point, 134);
            this.toolStripMenuItem_0    = new ToolStripMenuItem();
            this.toolStripMenuItem_1    = new ToolStripMenuItem();
            this.toolStripMenuItem_2    = new ToolStripMenuItem();
            this.toolStripMenuItem_3    = new ToolStripMenuItem();
            this.toolStripMenuItem_4    = new ToolStripMenuItem();
            this.toolStripMenuItem_23   = new ToolStripMenuItem();
            this.toolStripMenuItem_8    = new ToolStripMenuItem();
            this.toolStripMenuItem1     = new ToolStripMenuItem();
            this.toolStripMenuItem_7    = new ToolStripMenuItem();
            this.toolStripMenuItem_9    = new ToolStripMenuItem();
            this.toolStripMenuItem_25   = new ToolStripMenuItem();
            this.toolStripMenuItem_26   = new ToolStripMenuItem();
            this.toolStripMenuItem_27   = new ToolStripMenuItem();
            this.toolStripMenuItem_5    = new ToolStripMenuItem();
            this.toolStripMenuItem_13   = new ToolStripMenuItem();
            this.toolStripMenuItem_12   = new ToolStripMenuItem();
            this.高级设置ToolStripMenuItem  = new ToolStripMenuItem();
            this.图转文设置ToolStripMenuItem = new ToolStripMenuItem();
            this.toolStripMenuItem_14   = new ToolStripMenuItem();
            this.toolStripMenuItem_15   = new ToolStripMenuItem();
            this.toolStripMenuItem_16   = new ToolStripMenuItem();
            this.toolStripMenuItem_10   = new ToolStripMenuItem();
            this.toolStripMenuItem_11   = new ToolStripMenuItem();
            this.toolStripMenuItem_6    = new ToolStripMenuItem();
            this.toolStripMenuItem_18   = new ToolStripMenuItem();
            this.toolStripMenuItem_19   = new ToolStripMenuItem();
            this.toolStripMenuItem_24   = new ToolStripMenuItem();
            this.toolStripMenuItem_20   = new ToolStripMenuItem();
            this.toolStripMenuItem_21   = new ToolStripMenuItem();
            this.toolStripMenuItem_28   = new ToolStripMenuItem();
            this.dockPanel              = new DockPanel();
            this.timer_0 = new System.Windows.Forms.Timer(this.components);
            this.MainMenu.SuspendLayout();
            base.SuspendLayout();
            ToolStripItemCollection items = this.MainMenu.Items;

            ToolStripItem[] toolStripMenuItem0 = new ToolStripItem[] { this.toolStripMenuItem_0, this.toolStripMenuItem_4, this.toolStripMenuItem_5, this.toolStripMenuItem_10, this.toolStripMenuItem_6, this.toolStripMenuItem_18 };
            items.AddRange(toolStripMenuItem0);
            this.MainMenu.Location          = new Point(0, 0);
            this.MainMenu.MdiWindowListItem = this.toolStripMenuItem_6;
            this.MainMenu.Name       = "MainMenu";
            this.MainMenu.RenderMode = ToolStripRenderMode.System;
            this.MainMenu.Size       = new System.Drawing.Size(834, 25);
            this.MainMenu.TabIndex   = 0;
            this.MainMenu.Text       = Localization.Get("主菜单");
            ToolStripItemCollection dropDownItems = this.toolStripMenuItem_0.DropDownItems;

            toolStripMenuItem0 = new ToolStripItem[] { this.toolStripMenuItem_1, this.toolStripMenuItem_2, this.toolStripMenuItem_3 };
            dropDownItems.AddRange(toolStripMenuItem0);
            this.toolStripMenuItem_0.Name      = "toolStripMenuItem_0";
            this.toolStripMenuItem_0.Size      = new System.Drawing.Size(60, 21);
            this.toolStripMenuItem_0.Text      = Localization.Get("采集(&C)");
            this.toolStripMenuItem_1.Image     = (Image)componentResourceManager.GetObject("toolStripMenuItem_1.Image");
            this.toolStripMenuItem_1.Name      = "toolStripMenuItem_1";
            this.toolStripMenuItem_1.Size      = new System.Drawing.Size(152, 22);
            this.toolStripMenuItem_1.Text      = Localization.Get("标准采集模式");
            this.toolStripMenuItem_1.Click    += new EventHandler(this.toolStripMenuItem_1_Click);
            this.toolStripMenuItem_2.ForeColor = Color.Maroon;
            this.toolStripMenuItem_2.Image     = (Image)componentResourceManager.GetObject("toolStripMenuItem_2.Image");
            this.toolStripMenuItem_2.Name      = "toolStripMenuItem_2";
            this.toolStripMenuItem_2.Size      = new System.Drawing.Size(152, 22);
            this.toolStripMenuItem_2.Text      = Localization.Get("超级修复模式");
            this.toolStripMenuItem_2.Click    += new EventHandler(this.toolStripMenuItem_2_Click);
            this.toolStripMenuItem_3.Image     = (Image)componentResourceManager.GetObject("toolStripMenuItem_3.Image");
            this.toolStripMenuItem_3.Name      = "toolStripMenuItem_3";
            this.toolStripMenuItem_3.Size      = new System.Drawing.Size(152, 22);
            this.toolStripMenuItem_3.Text      = Localization.Get("手动控制模式");
            this.toolStripMenuItem_3.Click    += new EventHandler(this.toolStripMenuItem_3_Click);
            ToolStripItemCollection toolStripItemCollections = this.toolStripMenuItem_4.DropDownItems;

            toolStripMenuItem0 = new ToolStripItem[] { this.toolStripMenuItem_23, this.toolStripMenuItem_8, this.toolStripMenuItem1, this.toolStripMenuItem_7, this.toolStripMenuItem_9, this.toolStripMenuItem_25, this.toolStripMenuItem_26, this.toolStripMenuItem_27 };
            toolStripItemCollections.AddRange(toolStripMenuItem0);
            this.toolStripMenuItem_4.Name     = "toolStripMenuItem_4";
            this.toolStripMenuItem_4.Size     = new System.Drawing.Size(60, 21);
            this.toolStripMenuItem_4.Text     = Localization.Get("辅助(&A)");
            this.toolStripMenuItem_23.Name    = "toolStripMenuItem_23";
            this.toolStripMenuItem_23.Size    = new System.Drawing.Size(166, 22);
            this.toolStripMenuItem_23.Text    = Localization.Get("子窗口冲突监控");
            this.toolStripMenuItem_23.Click  += new EventHandler(this.toolStripMenuItem_23_Click);
            this.toolStripMenuItem_8.Name     = "toolStripMenuItem_8";
            this.toolStripMenuItem_8.Size     = new System.Drawing.Size(166, 22);
            this.toolStripMenuItem_8.Text     = Localization.Get("错误生成器");
            this.toolStripMenuItem_8.Click   += new EventHandler(this.toolStripMenuItem_8_Click);
            this.toolStripMenuItem1.Name      = "toolStripMenuItem1";
            this.toolStripMenuItem1.Size      = new System.Drawing.Size(166, 22);
            this.toolStripMenuItem1.Text      = ("数据库维护");
            this.toolStripMenuItem1.Visible   = false;
            this.toolStripMenuItem1.Click    += new EventHandler(this.toolStripMenuItem1_Click);
            this.toolStripMenuItem_7.Name     = "toolStripMenuItem_7";
            this.toolStripMenuItem_7.Size     = new System.Drawing.Size(166, 22);
            this.toolStripMenuItem_7.Text     = Localization.Get("批量生成");
            this.toolStripMenuItem_7.Click   += new EventHandler(this.toolStripMenuItem_7_Click);
            this.toolStripMenuItem_9.Name     = "toolStripMenuItem_9";
            this.toolStripMenuItem_9.Size     = new System.Drawing.Size(166, 22);
            this.toolStripMenuItem_9.Text     = Localization.Get("批量删除小说");
            this.toolStripMenuItem_9.Click   += new EventHandler(this.toolStripMenuItem_9_Click);
            this.toolStripMenuItem_25.Enabled = false;
            this.toolStripMenuItem_25.Name    = "toolStripMenuItem_25";
            this.toolStripMenuItem_25.Size    = new System.Drawing.Size(166, 22);
            this.toolStripMenuItem_25.Text    = Localization.Get("批量删除章节");
            this.toolStripMenuItem_25.Visible = false;
            this.toolStripMenuItem_26.Name    = "toolStripMenuItem_26";
            this.toolStripMenuItem_26.Size    = new System.Drawing.Size(166, 22);
            this.toolStripMenuItem_26.Text    = Localization.Get("更新小说信息");
            this.toolStripMenuItem_26.Click  += new EventHandler(this.toolStripMenuItem_26_Click);
            this.toolStripMenuItem_27.Name    = "toolStripMenuItem_27";
            this.toolStripMenuItem_27.Size    = new System.Drawing.Size(166, 22);
            this.toolStripMenuItem_27.Text    = Localization.Get("MYSQL时间换算");
            this.toolStripMenuItem_27.Click  += new EventHandler(this.toolStripMenuItem_27_Click);
            ToolStripItemCollection dropDownItems1 = this.toolStripMenuItem_5.DropDownItems;

            toolStripMenuItem0 = new ToolStripItem[] { this.toolStripMenuItem_13, this.toolStripMenuItem_12, this.高级设置ToolStripMenuItem, this.toolStripMenuItem_14, this.图转文设置ToolStripMenuItem, this.toolStripMenuItem_15, this.toolStripMenuItem_16 };
            dropDownItems1.AddRange(toolStripMenuItem0);
            this.toolStripMenuItem_5.Name      = "toolStripMenuItem_5";
            this.toolStripMenuItem_5.Size      = new System.Drawing.Size(59, 21);
            this.toolStripMenuItem_5.Text      = Localization.Get("设置(&S)");
            this.toolStripMenuItem_13.Name     = "toolStripMenuItem_13";
            this.toolStripMenuItem_13.Size     = new System.Drawing.Size(136, 22);
            this.toolStripMenuItem_13.Text     = Localization.Get("系统设置");
            this.toolStripMenuItem_13.Click   += new EventHandler(this.toolStripMenuItem_13_Click);
            this.toolStripMenuItem_12.Name     = "toolStripMenuItem_12";
            this.toolStripMenuItem_12.Size     = new System.Drawing.Size(136, 22);
            this.toolStripMenuItem_12.Text     = Localization.Get("分类对应");
            this.toolStripMenuItem_12.Click   += new EventHandler(this.toolStripMenuItem_12_Click);
            this.高级设置ToolStripMenuItem.Name    = Localization.Get("高级设置ToolStripMenuItem");
            this.高级设置ToolStripMenuItem.Size    = new System.Drawing.Size(136, 22);
            this.高级设置ToolStripMenuItem.Text    = Localization.Get("高级设置");
            this.高级设置ToolStripMenuItem.Click  += new EventHandler(this.高级设置ToolStripMenuItem_Click);
            this.图转文设置ToolStripMenuItem.Name   = Localization.Get("图转文设置ToolStripMenuItem");
            this.图转文设置ToolStripMenuItem.Size   = new System.Drawing.Size(152, 22);
            this.图转文设置ToolStripMenuItem.Text   = Localization.Get("附加设置");
            this.图转文设置ToolStripMenuItem.Click += new EventHandler(this.图转文设置ToolStripMenuItem_Click);
            this.toolStripMenuItem_14.Name     = Localization.Get("toolStripMenuItem_14");
            this.toolStripMenuItem_14.Size     = new System.Drawing.Size(136, 22);
            this.toolStripMenuItem_14.Text     = Localization.Get("生成设置");
            this.toolStripMenuItem_14.Click   += new EventHandler(this.toolStripMenuItem_14_Click);
            this.toolStripMenuItem_15.Name     = "toolStripMenuItem_15";
            this.toolStripMenuItem_15.Size     = new System.Drawing.Size(136, 22);
            this.toolStripMenuItem_15.Text     = Localization.Get("文字广告");
            this.toolStripMenuItem_15.Click   += new EventHandler(this.toolStripMenuItem_15_Click);
            this.toolStripMenuItem_16.Name     = "toolStripMenuItem_16";
            this.toolStripMenuItem_16.Size     = new System.Drawing.Size(136, 22);
            this.toolStripMenuItem_16.Text     = Localization.Get("过滤替换");
            this.toolStripMenuItem_16.Click   += new EventHandler(this.toolStripMenuItem_16_Click);
            ToolStripItemCollection toolStripItemCollections1 = this.toolStripMenuItem_10.DropDownItems;

            toolStripMenuItem0 = new ToolStripItem[] { this.toolStripMenuItem_11 };
            toolStripItemCollections1.AddRange(toolStripMenuItem0);
            this.toolStripMenuItem_10.Name   = "toolStripMenuItem_10";
            this.toolStripMenuItem_10.Size   = new System.Drawing.Size(60, 21);
            this.toolStripMenuItem_10.Text   = Localization.Get("规则(&R)");
            this.toolStripMenuItem_11.Name   = "toolStripMenuItem_11";
            this.toolStripMenuItem_11.Size   = new System.Drawing.Size(148, 22);
            this.toolStripMenuItem_11.Text   = Localization.Get("采集规则管理");
            this.toolStripMenuItem_11.Click += new EventHandler(this.toolStripMenuItem_11_Click);
            this.toolStripMenuItem_6.Name    = "toolStripMenuItem_6";
            this.toolStripMenuItem_6.Size    = new System.Drawing.Size(64, 21);
            this.toolStripMenuItem_6.Text    = Localization.Get("窗口(&W)");
            ToolStripItemCollection dropDownItems2 = this.toolStripMenuItem_18.DropDownItems;

            toolStripMenuItem0 = new ToolStripItem[] { this.toolStripMenuItem_19, this.toolStripMenuItem_24, this.toolStripMenuItem_20, this.toolStripMenuItem_21, this.toolStripMenuItem_28 };
            dropDownItems2.AddRange(toolStripMenuItem0);
            this.toolStripMenuItem_18.Name       = "toolStripMenuItem_18";
            this.toolStripMenuItem_18.Size       = new System.Drawing.Size(61, 21);
            this.toolStripMenuItem_18.Text       = Localization.Get("帮助(&H)");
            this.toolStripMenuItem_19.Name       = "toolStripMenuItem_19";
            this.toolStripMenuItem_19.Size       = new System.Drawing.Size(124, 22);
            this.toolStripMenuItem_19.Text       = Localization.Get("帮助内容");
            this.toolStripMenuItem_19.Click     += new EventHandler(this.toolStripMenuItem_19_Click);
            this.toolStripMenuItem_24.Name       = "toolStripMenuItem_24";
            this.toolStripMenuItem_24.Size       = new System.Drawing.Size(124, 22);
            this.toolStripMenuItem_24.Text       = Localization.Get("查看日志");
            this.toolStripMenuItem_24.Click     += new EventHandler(this.toolStripMenuItem_24_Click);
            this.toolStripMenuItem_20.Name       = "toolStripMenuItem_20";
            this.toolStripMenuItem_20.Size       = new System.Drawing.Size(124, 22);
            this.toolStripMenuItem_20.Text       = Localization.Get("检查更新");
            this.toolStripMenuItem_20.Visible    = false;
            this.toolStripMenuItem_20.Click     += new EventHandler(this.toolStripMenuItem_20_Click);
            this.toolStripMenuItem_21.Name       = "toolStripMenuItem_21";
            this.toolStripMenuItem_21.Size       = new System.Drawing.Size(124, 22);
            this.toolStripMenuItem_21.Text       = Localization.Get("最新消息");
            this.toolStripMenuItem_21.Click     += new EventHandler(this.toolStripMenuItem_21_Click);
            this.toolStripMenuItem_28.Name       = "toolStripMenuItem_28";
            this.toolStripMenuItem_28.Size       = new System.Drawing.Size(124, 22);
            this.toolStripMenuItem_28.Text       = Localization.Get("高级功能");
            this.toolStripMenuItem_28.Click     += new EventHandler(this.toolStripMenuItem_28_Click);
            this.dockPanel.ActiveAutoHideContent = null;
            this.dockPanel.Dock                     = DockStyle.Fill;
            this.dockPanel.DockBackColor            = SystemColors.AppWorkspace;
            this.dockPanel.Location                 = new Point(0, 0);
            this.dockPanel.Name                     = "dockPanel";
            this.dockPanel.Size                     = new System.Drawing.Size(834, 452);
            dockPanelGradient.EndColor              = SystemColors.ControlLight;
            dockPanelGradient.StartColor            = SystemColors.ControlLight;
            autoHideStripSkin.DockStripGradient     = dockPanelGradient;
            tabGradient.EndColor                    = SystemColors.Control;
            tabGradient.StartColor                  = SystemColors.Control;
            tabGradient.TextColor                   = SystemColors.ControlDarkDark;
            autoHideStripSkin.TabGradient           = tabGradient;
            dockPanelSkin.AutoHideStripSkin         = autoHideStripSkin;
            controlLightLight.EndColor              = SystemColors.ControlLightLight;
            controlLightLight.StartColor            = SystemColors.ControlLightLight;
            controlLightLight.TextColor             = SystemColors.ControlText;
            dockPaneStripGradient.ActiveTabGradient = controlLightLight;
            control.EndColor   = SystemColors.Control;
            control.StartColor = SystemColors.Control;
            dockPaneStripGradient.DockStripGradient = control;
            controlLight.EndColor   = SystemColors.ControlLight;
            controlLight.StartColor = SystemColors.ControlLight;
            controlLight.TextColor  = SystemColors.ControlText;
            dockPaneStripGradient.InactiveTabGradient = controlLight;
            dockPaneStripSkin.DocumentGradient        = dockPaneStripGradient;
            activeCaption.EndColor           = SystemColors.ActiveCaption;
            activeCaption.LinearGradientMode = LinearGradientMode.Vertical;
            activeCaption.StartColor         = SystemColors.GradientActiveCaption;
            activeCaption.TextColor          = SystemColors.ActiveCaptionText;
            dockPaneStripToolWindowGradient.ActiveCaptionGradient = activeCaption;
            controlText.EndColor   = SystemColors.Control;
            controlText.StartColor = SystemColors.Control;
            controlText.TextColor  = SystemColors.ControlText;
            dockPaneStripToolWindowGradient.ActiveTabGradient = controlText;
            dockPanelGradient1.EndColor   = SystemColors.ControlLight;
            dockPanelGradient1.StartColor = SystemColors.ControlLight;
            dockPaneStripToolWindowGradient.DockStripGradient = dockPanelGradient1;
            gradientInactiveCaption.EndColor           = SystemColors.GradientInactiveCaption;
            gradientInactiveCaption.LinearGradientMode = LinearGradientMode.Vertical;
            gradientInactiveCaption.StartColor         = SystemColors.GradientInactiveCaption;
            gradientInactiveCaption.TextColor          = SystemColors.ControlText;
            dockPaneStripToolWindowGradient.InactiveCaptionGradient = gradientInactiveCaption;
            transparent.EndColor   = Color.Transparent;
            transparent.StartColor = Color.Transparent;
            transparent.TextColor  = SystemColors.ControlDarkDark;
            dockPaneStripToolWindowGradient.InactiveTabGradient = transparent;
            dockPaneStripSkin.ToolWindowGradient = dockPaneStripToolWindowGradient;
            dockPanelSkin.DockPaneStripSkin      = dockPaneStripSkin;
            this.dockPanel.Skin     = dockPanelSkin;
            this.dockPanel.TabIndex = 2;
            this.timer_0.Interval   = 1000;
            this.timer_0.Tick      += new EventHandler(this.timer_0_Tick);
            this.BackColor          = SystemColors.Control;
            base.ClientSize         = new System.Drawing.Size(834, 452);
            base.Controls.Add(this.MainMenu);
            base.Controls.Add(this.dockPanel);
            base.Icon           = (System.Drawing.Icon)componentResourceManager.GetObject("$this.Icon");
            base.IsMdiContainer = true;
            base.MainMenuStrip  = this.MainMenu;
            base.Name           = "MdiForm";
            base.StartPosition  = FormStartPosition.CenterScreen;
            this.Text           = Localization.Get("超级小说采集器 V8.0");
            base.Load          += new EventHandler(this.MdiForm_Load);
            base.Shown         += new EventHandler(this.MdiForm_Shown);
            this.MainMenu.ResumeLayout(false);
            this.MainMenu.PerformLayout();
            base.ResumeLayout(false);
            base.PerformLayout();
        }
        public void Remove_Owned()
        {
            ToolStrip toolStrip           = CreateToolStrip();
            ToolStripItemCollection items = toolStrip.Items;

            MockToolStripButton buttonA = new MockToolStripButton("A");
            MockToolStripButton buttonB = new MockToolStripButton("B");
            MockToolStripButton buttonC = new MockToolStripButton("B");

            items.Insert(0, buttonA);
            items.Insert(0, buttonB);

            items.Remove(buttonB);
            Assert.AreEqual(1, items.Count, "#A1");
            Assert.AreEqual(1, itemsRemoved.Count, "#A2");
            Assert.AreSame(buttonA, items [0], "#A3");
            Assert.AreSame(buttonB, itemsRemoved [0], "#A4");
            Assert.IsNull(buttonB.Owner, "#A5");
            Assert.IsNull(buttonB.ParentToolStrip, "#A6");

            // remove null item
            items.Remove((ToolStripItem)null);
            Assert.AreEqual(1, items.Count, "#B1");
            Assert.AreEqual(2, itemsRemoved.Count, "#B2");
            Assert.AreSame(buttonA, items [0], "#B3");
            Assert.IsNull(itemsRemoved [1], "#B4");

            // remove item not owner by toolstrip
            items.Remove(buttonC);
            Assert.AreEqual(1, items.Count, "#C1");
            Assert.AreEqual(3, itemsRemoved.Count, "#C2");
            Assert.AreSame(buttonA, items [0], "#C3");
            Assert.AreSame(buttonC, itemsRemoved [2], "#C4");
            Assert.IsNull(buttonC.Owner, "#C5");
            Assert.IsNull(buttonC.ParentToolStrip, "#C6");

            items.Remove(buttonA);
            Assert.AreEqual(0, items.Count, "#D1");
            Assert.AreEqual(4, itemsRemoved.Count, "#D2");
            Assert.AreSame(buttonA, itemsRemoved [3], "#D3");
            Assert.IsNull(buttonC.Owner, "#D4");
            Assert.IsNull(buttonC.ParentToolStrip, "#D5");

            // remove item which is no longer in the collection
            items.Remove(buttonA);
            Assert.AreEqual(0, items.Count, "#E1");
            Assert.AreEqual(5, itemsRemoved.Count, "#E2");
            Assert.AreSame(buttonA, itemsRemoved [4], "#E3");

            // remove item owned by other toolstrip
            ToolStrip           otherToolStrip = new ToolStrip();
            MockToolStripButton buttonD        = new MockToolStripButton("B");

            otherToolStrip.Items.Add(buttonD);
            Assert.AreSame(otherToolStrip, buttonD.Owner, "#F1");
            Assert.IsNull(buttonD.ParentToolStrip, "#F2");
            items.Remove(buttonD);
            Assert.AreEqual(0, items.Count, "#F3");
            Assert.AreEqual(6, itemsRemoved.Count, "#F4");
            Assert.IsNull(buttonD.Owner, "#F5");
            Assert.IsNull(buttonD.ParentToolStrip, "#F6");
        }
Пример #20
0
 private void AddItemsToMenuItemList(ToolStripItemCollection items)
 {
     foreach (ToolStripItem item in items)
     {
         var itemProxy = ToolStripItemProxy.GetProxyFromCache(item);
         if (!mMenuItemList.Contains(itemProxy))
         {
             mMenuItemList.Add(itemProxy);
         }
         var dropDownItem = item as ToolStripDropDownItem;
         if (dropDownItem != null)
         {
             AddItemsToMenuItemList(dropDownItem.DropDownItems);
             dropDownItem.DropDown.ItemAdded += (sender, e) =>
             {
                 var addedItemProxy = ToolStripItemProxy.GetProxyFromCache(e.Item);
                 if (!mMenuItemList.Contains(addedItemProxy))
                 {
                     mMenuItemList.Add(addedItemProxy);
                 }
                 if (dropDownItem.DropDownItems.Count == 1)
                 {
                     OnItemPropertyChanged("children-display", addedItemProxy);
                 }
             };
             dropDownItem.DropDown.ItemRemoved += (sender, e) =>
             {
                 var addedItemProxy = ToolStripItemProxy.GetProxyFromCache(e.Item);
                 // set to null instead of removing because we are using the index
                 // as the id and we don't want to mess it up.
                 var itemIndex = mMenuItemList.IndexOf(addedItemProxy);
                 mMenuItemList[itemIndex] = null;
                 if (dropDownItem.DropDownItems.Count == 0)
                 {
                     OnItemPropertyChanged("children-display", addedItemProxy);
                 }
             };
             var menuItem      = dropDownItem as ToolStripMenuItem;
             var menuItemProxy = ToolStripItemProxy.GetProxyFromCache(item);
             if (menuItem != null)
             {
                 menuItem.CheckStateChanged += (sender, e) =>
                                               OnItemPropertyChanged("toggle-state", menuItemProxy);
             }
         }
         item.TextChanged += (sender, e) =>
                             OnItemPropertyChanged("label", itemProxy);
         item.EnabledChanged += (sender, e) =>
         {
             if (item.Image != null)
             {
                 OnItemPropertiesChanged(new string[] { "enabled", "icon-data" },
                                         itemProxy);
             }
             else
             {
                 OnItemPropertyChanged("enabled", itemProxy);
             }
         };
         item.AvailableChanged += (sender, e) =>
                                  OnItemPropertyChanged("visible", itemProxy);
     }
 }
Пример #21
0
        private void InsertItem(IEnumerable <string> structure, Type t, ToolStripItem item, ToolStripItemCollection parentItems)
        {
            ToolStripDropDownItem parent = null;

            foreach (string s in structure)
            {
                if (parentItems.ContainsKey(s))
                {
                    parent = (ToolStripDropDownItem)parentItems[s];
                }
                else
                {
                    parent = (ToolStripDropDownItem)Activator.CreateInstance(t, s, null, null, s);;
                    parentItems.Add(parent);
                }
                parentItems = parent.DropDownItems;
            }
            parentItems.Add(item);
        }
Пример #22
0
        /// <summary>
        /// Builds ands returns a context menu for commits
        /// </summary>
        public ToolStripItemCollection GetContextMenu(ToolStrip owner, object tag)
        {
            // Make sure not to touch the 'status' if it's null
            bool isMergeState = status != null && status.IsMergeState();

            // Build the "Edit Using" submenus
            // The default option is to open the file using the OS-associated editor,
            // after which all the user-specified programs are listed
            ToolStripMenuItem mEditAssoc = new ToolStripMenuItem("Associated Editor", null, MenuEditClick)
            {
                ShortcutKeys = Keys.Control | Keys.Enter
            };                                                                                                                                           // Enter on it's own is better, but is not supported
            ToolStripMenuItem mEdit = new ToolStripMenuItem("Edit Using");

            mEdit.DropDownItems.Add(mEditAssoc);
            string values = Properties.Settings.Default.EditViewPrograms;

            string[] progs = values.Split(("\0").ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            if (progs.Any())
            {
                mEdit.DropDownItems.Add(new ToolStripMenuItem(Path.GetFileName(progs[0]), null, MenuEditClick)
                {
                    Tag = progs[0], ShortcutKeys = Keys.Control | Keys.Shift | Keys.Enter
                });
                foreach (string s in progs.Skip(1))
                {
                    mEdit.DropDownItems.Add(new ToolStripMenuItem(Path.GetFileName(s), null, MenuEditClick)
                    {
                        Tag = s
                    });
                }
            }

            ToolStripMenuItem mDiff = new ToolStripMenuItem("Diff vs Repo HEAD", null, MenuDiffClick, Keys.Control | Keys.Z)
            {
                Tag = tag
            };
            ToolStripMenuItem mRevHist = new ToolStripMenuItem("Revision History...", null, MenuEditRevHistClick)
            {
            };

            ToolStripMenuItem mSub = isMergeState
                                         ? new ToolStripMenuItem("Submit Merge...", null, MenuSubmitMergeClick, Keys.Control | Keys.S)
                                         : new ToolStripMenuItem("Submit...", null, MenuSubmitClick, Keys.Control | Keys.S)
            {
                Tag = tag
            };
            ToolStripMenuItem mNew      = new ToolStripMenuItem("New Changelist...", null, MenuNewCommitClick);
            ToolStripMenuItem mEditSpec = isMergeState
                                          ? new ToolStripMenuItem("Edit Merge Spec...", null, MenuEditCommitMergeClick)
                                          : new ToolStripMenuItem("Edit Spec...", null, MenuEditCommitClick)
            {
                Tag = tag
            };
            ToolStripMenuItem mDel = new ToolStripMenuItem("Delete Empty Changelist", null, MenuDeleteEmptyClick, Keys.Delete)
            {
                Tag = tag
            };
            ToolStripMenuItem mUnstage = new ToolStripMenuItem("Unstage", null, MenuUnstageClick)
            {
                Tag = tag
            };

            // Build the "Resolve" submenu
            ToolStripMenuItem mResolveTool = new ToolStripMenuItem("Run Merge Tool...", null, MenuMergeTool)
            {
                Tag = tag
            };
            ToolStripMenuItem mAcceptOurs = new ToolStripMenuItem("Accept ours", null, MenuAcceptClick)
            {
                Tag = "--ours"
            };
            ToolStripMenuItem mAcceptTheirs = new ToolStripMenuItem("Accept theirs", null, MenuAcceptClick)
            {
                Tag = "--theirs"
            };
            ToolStripMenuItem mAbort     = new ToolStripMenuItem("Abort Merge", null, MenuAbortMergeClick);
            ToolStripMenuItem mExitMerge = new ToolStripMenuItem("Exit Merge state", null, MenuExitMergeClick);
            ToolStripMenuItem mResolve   = new ToolStripMenuItem("Resolve");

            mResolve.DropDownItems.AddRange(new ToolStripItem[] {
                mResolveTool, mAcceptOurs, mAcceptTheirs,
                new ToolStripSeparator(),
                mAbort, mExitMerge
            });

            ToolStripItemCollection menu = new ToolStripItemCollection(owner, new ToolStripItem[] {
                mEdit, mDiff, mRevHist,
                new ToolStripSeparator(),
                mSub,
                new ToolStripSeparator(),
                mNew, mEditSpec, mDel,
                new ToolStripSeparator(),
                mUnstage,
                mResolve
            });

            if (GetSelectedFile() == string.Empty)
            {
                mEdit.Enabled = mRevHist.Enabled = false;
            }

            if (GetSelectedFiles().Count == 0)
            {
                mDiff.Enabled = false;
            }

            if (treeCommits.Nodes.Count == 0 || tag == treeCommits.Nodes[0].Tag)
            {
                mSub.Enabled = false;
            }

            if (App.Repos.Current == null)
            {
                mDiff.Enabled = mNew.Enabled = mUnstage.Enabled = false;
            }

            if (!(tag is ClassCommit))
            {
                mEditSpec.Enabled = false;
            }

            if (!(tag is ClassCommit && (tag as ClassCommit).Files.Count == 0 && !(tag as ClassCommit).IsDefault))
            {
                mDel.Enabled = false;
            }

            if (GetFilesToUnstage(tag).Count == 0)
            {
                mUnstage.Enabled = false;
            }

            // If the repo is the merge state, adjust some menu enables
            if (!isMergeState)
            {
                mResolve.Enabled = false; // Disable resolves if the repo is _not_ in the merge state
            }
            else
            {
                if (status.IsUnmerged()) // If there are files that are not merged yet, do not allow submits
                {
                    mSub.Enabled       = false;
                    mExitMerge.Enabled = false;

                    // Enable accept choices only when some files are selected
                    if (treeCommits.SelectedNodes.Count == 0)
                    {
                        mAcceptOurs.Enabled = mAcceptTheirs.Enabled = false;
                    }
                }
                else // If there are no unmerged files left disable resolve tools
                {
                    mResolveTool.Enabled = false;
                    mAcceptOurs.Enabled  = mAcceptTheirs.Enabled = false;
                }
            }

            return(menu);
        }
Пример #23
0
        /// <summary>
        /// Builds ands returns a context menu for files
        /// </summary>
        public ToolStripItemCollection GetContextMenu(ToolStrip owner)
        {
            ToolStripMenuItem mUpdate = new ToolStripMenuItem("Update Changelist", null, MenuViewUpdateChangelistClick);
            ToolStripMenuItem mRevert = new ToolStripMenuItem("Revert", null, MenuViewRevertClick);

            // Build the "Diff vs" submenu
            ToolStripMenuItem mDiffIndex = new ToolStripMenuItem("Index", null, MenuViewDiffClick)
            {
                ShortcutKeys = Keys.Control | Keys.D, Tag = ""
            };
            ToolStripMenuItem mDiffHead = new ToolStripMenuItem("Repository HEAD", null, MenuViewDiffClick)
            {
                ShortcutKeys = Keys.Control | Keys.Shift | Keys.D, Tag = "HEAD"
            };
            ToolStripMenuItem mDiff = new ToolStripMenuItem("Diff vs");

            mDiff.DropDownItems.Add(mDiffIndex);
            mDiff.DropDownItems.Add(mDiffHead);

            // Build the "Edit Using" submenus
            // The default option is to open the file using the OS-associated editor,
            // after which all the user-specified programs are listed
            ToolStripMenuItem mEditAssoc = new ToolStripMenuItem("Associated Editor", null, MenuViewEditClick)
            {
                ShortcutKeys = Keys.Control | Keys.Enter
            };                                                                                                                                               // Enter on it's own is better, but is not supported
            ToolStripMenuItem mEdit = new ToolStripMenuItem("Edit Using");

            mEdit.DropDownItems.Add(mEditAssoc);
            string values = Properties.Settings.Default.EditViewPrograms;

            string[] progs = values.Split(("\0").ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            if (progs.Any())
            {
                mEdit.DropDownItems.Add(new ToolStripMenuItem(Path.GetFileName(progs[0]), null, MenuViewEditClick)
                {
                    Tag = progs[0], ShortcutKeys = Keys.Control | Keys.Shift | Keys.Enter
                });
                foreach (string s in progs.Skip(1))
                {
                    mEdit.DropDownItems.Add(new ToolStripMenuItem(Path.GetFileName(s), null, MenuViewEditClick)
                    {
                        Tag = s
                    });
                }
            }

            ToolStripMenuItem mRevHist = new ToolStripMenuItem("Revision History...", null, MenuViewRevHistClick)
            {
                ShortcutKeys = Keys.Control | Keys.H
            };
            ToolStripMenuItem mRename = new ToolStripMenuItem("Move/Rename...", null, MenuViewRenameClick);
            ToolStripMenuItem mDelete = new ToolStripMenuItem("Open for Delete", null, MenuViewOpenForDeleteClick);
            ToolStripMenuItem mRemove = new ToolStripMenuItem("Remove from File System", null, MenuViewRemoveFromFsClick);

            ToolStripMenuItem mExplore = new ToolStripMenuItem("Explore...", null, MenuViewExploreClick);
            ToolStripMenuItem mCommand = new ToolStripMenuItem("Command Prompt...", null, MenuViewCommandClick);

            ToolStripItemCollection menu = new ToolStripItemCollection(owner, new ToolStripItem[] {
                mUpdate,
                mRevert,
                mDiff,
                mEdit,
                mRevHist,
                new ToolStripSeparator(),
                mRename,
                mDelete,
                mRemove,
                new ToolStripSeparator(),
                mExplore, mCommand
            });

            // Enable only menu items which match the selected file conditions
            // This is a translation dictionary for our menu items
            Dictionary <FileOps, ToolStripMenuItem> menus = new Dictionary <FileOps, ToolStripMenuItem> {
                { FileOps.Update, mUpdate },
                { FileOps.Revert, mRevert },
                { FileOps.Diff, mDiff },
                { FileOps.Edit, mEdit },
                { FileOps.Rename, mRename },
                { FileOps.Delete, mDelete },
                { FileOps.DeleteFs, mRemove },
            };

            // First disable all tracked menu items);
            foreach (var toolStripMenuItem in menus)
            {
                toolStripMenuItem.Value.Enabled = false;
            }

            // If there is no current repo, disable every remaining menu in this collection
            if (App.Repos.Current == null)
            {
                mRevHist.Enabled = mExplore.Enabled = mCommand.Enabled = false;
            }
            else
            {
                // Enable all items which are allowed according to our latest selection
                foreach (var allowedOp in allowedOps.Where(menus.ContainsKey))
                {
                    menus[allowedOp].Enabled = true;
                }

                // A bit of a hack, but revision history on a file is enabled when the edit on a file is enabled
                mRevHist.Enabled = mEdit.Enabled;
            }
            return(menu);
        }
Пример #24
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            ToolStripItemCollection tmnu = menuStrip1.Items;

            SetToolStripItems(tmnu);

            mnuAdmin.Enabled      = true;
            mnuConfig.Enabled     = true;
            mnuMast.Enabled       = true;
            mnuProfile.Enabled    = true;
            mnuEmployee.Enabled   = true;
            mnuMess.Enabled       = true;
            mnuTranS.Enabled      = true;
            mnuLeave.Enabled      = true;
            mnuShift.Enabled      = true;
            mnuSanction.Enabled   = true;
            mnuData.Enabled       = true;
            mnuCostCent.Enabled   = true;
            mnuChangePass.Enabled = true;
            mnuLogOff.Enabled     = true;

            DataSet ds  = new DataSet();
            string  sql = "select menuname from  MastFrm where formid in (select FormId from userRights where UserId ='" + Utils.User.GUserID + "' and View1=1) order by seqid";

            ds = Utils.Helper.GetData(sql, cnstr);

            mnuUser.Enabled = true;
            Boolean hasRows = ds.Tables.Cast <DataTable>()
                              .Any(table => table.Rows.Count != 0);


            if (hasRows)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    string mnu = dr["menuname"].ToString();

                    ToolStripItem[] t = tmnu.Find(mnu, true);

                    foreach (ToolStripItem ti in t)
                    {
                        ti.Enabled = true;
                    }
                }
            }

            this.mnuHelp.Enabled       = true;
            this.mnuReports.Enabled    = true;
            this.mnuAbout.Enabled      = true;
            this.mnuStatus.Enabled     = true;
            this.mnuServerStat.Enabled = true;


            //Set GateInOutIP
            Globals.SetGateInOutIPList();

            //set LunchInOutIP
            Globals.SetLunchInOutIPList();

            //set waterip
            Globals.SetWaterIPList();

            //set ShiftList
            Globals.SetShiftList();

            //set global vars
            Globals.GetGlobalVars();

            //get localmodification date
            string     codeBase  = Assembly.GetExecutingAssembly().CodeBase;
            UriBuilder uri       = new UriBuilder(codeBase);
            string     localfile = Uri.UnescapeDataString(uri.Path);

            if (IsNetworkPath(localfile))
            {
                MessageBox.Show("Does not allow to run from remote location/shared folder..," +
                                Environment.NewLine +
                                "Please Copy to Local Drive and Run Again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                this.Close();
            }


            //here we can start Quartz if host is server
            if (Utils.User.GUserID == "SERVER")
            {
                Globals.G_myscheduler = new Scheduler();

                mnuRFIDUser.Enabled                = true;
                mnuDataDownload.Enabled            = true;
                mnuDataProcess.Enabled             = true;
                mnuAutoMailSender.Enabled          = true;
                mnuCostCodeManPowerProcess.Enabled = true;
                mnuReports.Enabled      = true;
                mnuAbout.Enabled        = true;
                MnuReaderConfig.Enabled = true;

                Form t = Application.OpenForms["frmServerStatus"];

                if (t == null)
                {
                    Attendance.Forms.frmServerStatus m = new Attendance.Forms.frmServerStatus();
                    m.MdiParent   = this;
                    m.WindowState = FormWindowState.Maximized;
                    m.Show();
                }

                Thread.Sleep(TimeSpan.FromSeconds(5));

                Globals.G_myscheduler.Start();
                //create triggers
                Globals.G_myscheduler.RegSchedule_AutoTimeSet();
                Globals.G_myscheduler.RegSchedule_WorkerProcess();
                Globals.G_myscheduler.RegSchedule_AutoArrival();
                Globals.G_myscheduler.RegSchedule_AutoProcess();
                Globals.G_myscheduler.RegSchedule_DownloadPunch();
                Globals.G_myscheduler.RegSchedule_BlockUnBlockProcess();
                Globals.G_myscheduler.RegSchedule_AutoMail();
            }
            else
            {
                //check for update version.
                DateTime servermodified = new DateTime();
                DateTime localmodified  = new DateTime();

                if (!string.IsNullOrEmpty(Globals.G_UpdateChkPath))
                {
                    this.Cursor = Cursors.WaitCursor;
                    Application.DoEvents();

                    using (UNCAccessWithCredentials unc = new UNCAccessWithCredentials())
                    {
                        if (unc.NetUseWithCredentials(Globals.G_UpdateChkPath,
                                                      Globals.G_NetworkUser,
                                                      Globals.G_NetworkDomain,
                                                      Globals.G_NetworkPass))
                        {
                            string fullpath = Path.Combine(Globals.G_UpdateChkPath, "AttendanceBEL.exe");
                            if (File.Exists(fullpath))
                            {
                                servermodified = File.GetLastWriteTime(fullpath);
                            }
                        }
                    }



                    localmodified = File.GetLastWriteTime(localfile);
                    if (servermodified > localmodified)
                    {
                        MessageBox.Show("New Upgrade is available, please update", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }
                    this.Cursor = Cursors.Default;
                }
            }
        }
Пример #25
0
        private static void InitializeFormToolStripItemPermission(List <string> controlNames, ToolStripItemCollection toolStripItems)
        {
            if (toolStripItems.Count > 0)
            {
                foreach (ToolStripItem toolStripItem in toolStripItems)
                {
                    if (object.Equals(toolStripItem.Tag, UtilConstants.PERMISSION_FLAG))
                    {
                        if (controlNames.Contains(toolStripItem.Name))
                        {
                            toolStripItem.Enabled = true;

                            if (toolStripItem is ToolStripMenuItem)
                            {
                                InitializeFormToolStripItemPermission(controlNames, ((ToolStripMenuItem)toolStripItem).DropDownItems);
                            }
                        }
                        else
                        {
                            toolStripItem.Enabled = false;
                        }
                    }
                    else
                    {
                        if (toolStripItem is ToolStripMenuItem)
                        {
                            InitializeFormToolStripItemPermission(controlNames, ((ToolStripMenuItem)toolStripItem).DropDownItems);
                        }
                    }
                }
            }
        }
Пример #26
0
        private void InitializeComponent()
        {
            ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(OptionRaceForm));

            this.NameLbl          = new Label();
            this.NameBox          = new TextBox();
            this.Pages            = new TabControl();
            this.TraitsPage       = new TabPage();
            this.SkillBonusBox    = new TextBox();
            this.LanguageBox      = new TextBox();
            this.VisionBox        = new TextBox();
            this.SpeedBox         = new TextBox();
            this.SizeBox          = new ComboBox();
            this.AbilityScoreBox  = new TextBox();
            this.WeightBox        = new TextBox();
            this.HeightBox        = new TextBox();
            this.SkillBonusLbl    = new Label();
            this.LanguageLbl      = new Label();
            this.VisionLbl        = new Label();
            this.SpeedLbl         = new Label();
            this.SizeLbl          = new Label();
            this.AbilityScoreLbl  = new Label();
            this.WeightLbl        = new Label();
            this.HeightLbl        = new Label();
            this.DetailsPage      = new TabPage();
            this.DetailsBox       = new TextBox();
            this.FeaturesPage     = new TabPage();
            this.FeatureList      = new ListView();
            this.FeatureHdr       = new ColumnHeader();
            this.FeatureToolbar   = new ToolStrip();
            this.FeatureAddBtn    = new ToolStripButton();
            this.FeatureRemoveBtn = new ToolStripButton();
            this.FeatureEditBtn   = new ToolStripButton();
            this.PowersPage       = new TabPage();
            this.PowerList        = new ListView();
            this.PowerHdr         = new ColumnHeader();
            this.PowerToolbar     = new ToolStrip();
            this.PowerAddBtn      = new ToolStripButton();
            this.PowerRemoveBtn   = new ToolStripButton();
            this.PowerEditBtn     = new ToolStripButton();
            this.OKBtn            = new Button();
            this.CancelBtn        = new Button();
            this.QuoteLbl         = new Label();
            this.QuoteBox         = new TextBox();
            this.Pages.SuspendLayout();
            this.TraitsPage.SuspendLayout();
            this.DetailsPage.SuspendLayout();
            this.FeaturesPage.SuspendLayout();
            this.FeatureToolbar.SuspendLayout();
            this.PowersPage.SuspendLayout();
            this.PowerToolbar.SuspendLayout();
            base.SuspendLayout();
            this.NameLbl.AutoSize = true;
            this.NameLbl.Location = new Point(12, 15);
            this.NameLbl.Name     = "NameLbl";
            this.NameLbl.Size     = new System.Drawing.Size(38, 13);
            this.NameLbl.TabIndex = 0;
            this.NameLbl.Text     = "Name:";
            this.NameBox.Anchor   = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            this.NameBox.Location = new Point(56, 12);
            this.NameBox.Name     = "NameBox";
            this.NameBox.Size     = new System.Drawing.Size(305, 20);
            this.NameBox.TabIndex = 1;
            this.Pages.Anchor     = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
            this.Pages.Controls.Add(this.TraitsPage);
            this.Pages.Controls.Add(this.DetailsPage);
            this.Pages.Controls.Add(this.FeaturesPage);
            this.Pages.Controls.Add(this.PowersPage);
            this.Pages.Location      = new Point(12, 38);
            this.Pages.Name          = "Pages";
            this.Pages.SelectedIndex = 0;
            this.Pages.Size          = new System.Drawing.Size(349, 248);
            this.Pages.TabIndex      = 2;
            this.TraitsPage.Controls.Add(this.SkillBonusBox);
            this.TraitsPage.Controls.Add(this.LanguageBox);
            this.TraitsPage.Controls.Add(this.VisionBox);
            this.TraitsPage.Controls.Add(this.SpeedBox);
            this.TraitsPage.Controls.Add(this.SizeBox);
            this.TraitsPage.Controls.Add(this.AbilityScoreBox);
            this.TraitsPage.Controls.Add(this.WeightBox);
            this.TraitsPage.Controls.Add(this.HeightBox);
            this.TraitsPage.Controls.Add(this.SkillBonusLbl);
            this.TraitsPage.Controls.Add(this.LanguageLbl);
            this.TraitsPage.Controls.Add(this.VisionLbl);
            this.TraitsPage.Controls.Add(this.SpeedLbl);
            this.TraitsPage.Controls.Add(this.SizeLbl);
            this.TraitsPage.Controls.Add(this.AbilityScoreLbl);
            this.TraitsPage.Controls.Add(this.WeightLbl);
            this.TraitsPage.Controls.Add(this.HeightLbl);
            this.TraitsPage.Location = new Point(4, 22);
            this.TraitsPage.Name     = "TraitsPage";
            this.TraitsPage.Padding  = new System.Windows.Forms.Padding(3);
            this.TraitsPage.Size     = new System.Drawing.Size(341, 222);
            this.TraitsPage.TabIndex = 1;
            this.TraitsPage.Text     = "Racial Traits";
            this.TraitsPage.UseVisualStyleBackColor = true;
            this.SkillBonusBox.Anchor      = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            this.SkillBonusBox.Location    = new Point(99, 189);
            this.SkillBonusBox.Name        = "SkillBonusBox";
            this.SkillBonusBox.Size        = new System.Drawing.Size(236, 20);
            this.SkillBonusBox.TabIndex    = 15;
            this.LanguageBox.Anchor        = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            this.LanguageBox.Location      = new Point(99, 163);
            this.LanguageBox.Name          = "LanguageBox";
            this.LanguageBox.Size          = new System.Drawing.Size(236, 20);
            this.LanguageBox.TabIndex      = 13;
            this.VisionBox.Anchor          = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            this.VisionBox.Location        = new Point(99, 137);
            this.VisionBox.Name            = "VisionBox";
            this.VisionBox.Size            = new System.Drawing.Size(236, 20);
            this.VisionBox.TabIndex        = 11;
            this.SpeedBox.Anchor           = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            this.SpeedBox.Location         = new Point(99, 111);
            this.SpeedBox.Name             = "SpeedBox";
            this.SpeedBox.Size             = new System.Drawing.Size(236, 20);
            this.SpeedBox.TabIndex         = 9;
            this.SizeBox.Anchor            = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            this.SizeBox.DropDownStyle     = ComboBoxStyle.DropDownList;
            this.SizeBox.FormattingEnabled = true;
            this.SizeBox.Location          = new Point(99, 84);
            this.SizeBox.Name             = "SizeBox";
            this.SizeBox.Size             = new System.Drawing.Size(236, 21);
            this.SizeBox.TabIndex         = 7;
            this.AbilityScoreBox.Anchor   = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            this.AbilityScoreBox.Location = new Point(99, 58);
            this.AbilityScoreBox.Name     = "AbilityScoreBox";
            this.AbilityScoreBox.Size     = new System.Drawing.Size(236, 20);
            this.AbilityScoreBox.TabIndex = 5;
            this.WeightBox.Anchor         = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            this.WeightBox.Location       = new Point(99, 32);
            this.WeightBox.Name           = "WeightBox";
            this.WeightBox.Size           = new System.Drawing.Size(236, 20);
            this.WeightBox.TabIndex       = 3;
            this.HeightBox.Anchor         = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            this.HeightBox.Location       = new Point(99, 6);
            this.HeightBox.Name           = "HeightBox";
            this.HeightBox.Size           = new System.Drawing.Size(236, 20);
            this.HeightBox.TabIndex       = 1;
            this.SkillBonusLbl.AutoSize   = true;
            this.SkillBonusLbl.Location   = new Point(6, 192);
            this.SkillBonusLbl.Name       = "SkillBonusLbl";
            this.SkillBonusLbl.Size       = new System.Drawing.Size(73, 13);
            this.SkillBonusLbl.TabIndex   = 14;
            this.SkillBonusLbl.Text       = "Skill Bonuses:";
            this.LanguageLbl.AutoSize     = true;
            this.LanguageLbl.Location     = new Point(6, 166);
            this.LanguageLbl.Name         = "LanguageLbl";
            this.LanguageLbl.Size         = new System.Drawing.Size(63, 13);
            this.LanguageLbl.TabIndex     = 12;
            this.LanguageLbl.Text         = "Languages:";
            this.VisionLbl.AutoSize       = true;
            this.VisionLbl.Location       = new Point(6, 140);
            this.VisionLbl.Name           = "VisionLbl";
            this.VisionLbl.Size           = new System.Drawing.Size(38, 13);
            this.VisionLbl.TabIndex       = 10;
            this.VisionLbl.Text           = "Vision:";
            this.SpeedLbl.AutoSize        = true;
            this.SpeedLbl.Location        = new Point(6, 114);
            this.SpeedLbl.Name            = "SpeedLbl";
            this.SpeedLbl.Size            = new System.Drawing.Size(41, 13);
            this.SpeedLbl.TabIndex        = 8;
            this.SpeedLbl.Text            = "Speed:";
            this.SizeLbl.AutoSize         = true;
            this.SizeLbl.Location         = new Point(6, 87);
            this.SizeLbl.Name             = "SizeLbl";
            this.SizeLbl.Size             = new System.Drawing.Size(30, 13);
            this.SizeLbl.TabIndex         = 6;
            this.SizeLbl.Text             = "Size:";
            this.AbilityScoreLbl.AutoSize = true;
            this.AbilityScoreLbl.Location = new Point(6, 61);
            this.AbilityScoreLbl.Name     = "AbilityScoreLbl";
            this.AbilityScoreLbl.Size     = new System.Drawing.Size(73, 13);
            this.AbilityScoreLbl.TabIndex = 4;
            this.AbilityScoreLbl.Text     = "Ability Scores:";
            this.WeightLbl.AutoSize       = true;
            this.WeightLbl.Location       = new Point(6, 35);
            this.WeightLbl.Name           = "WeightLbl";
            this.WeightLbl.Size           = new System.Drawing.Size(87, 13);
            this.WeightLbl.TabIndex       = 2;
            this.WeightLbl.Text           = "Average Weight:";
            this.HeightLbl.AutoSize       = true;
            this.HeightLbl.Location       = new Point(6, 9);
            this.HeightLbl.Name           = "HeightLbl";
            this.HeightLbl.Size           = new System.Drawing.Size(84, 13);
            this.HeightLbl.TabIndex       = 0;
            this.HeightLbl.Text           = "Average Height:";
            this.DetailsPage.Controls.Add(this.QuoteBox);
            this.DetailsPage.Controls.Add(this.QuoteLbl);
            this.DetailsPage.Controls.Add(this.DetailsBox);
            this.DetailsPage.Location = new Point(4, 22);
            this.DetailsPage.Name     = "DetailsPage";
            this.DetailsPage.Padding  = new System.Windows.Forms.Padding(3);
            this.DetailsPage.Size     = new System.Drawing.Size(341, 222);
            this.DetailsPage.TabIndex = 0;
            this.DetailsPage.Text     = "Details";
            this.DetailsPage.UseVisualStyleBackColor = true;
            this.DetailsBox.AcceptsReturn            = true;
            this.DetailsBox.AcceptsTab = true;
            this.DetailsBox.Anchor     = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
            this.DetailsBox.Location   = new Point(6, 6);
            this.DetailsBox.Multiline  = true;
            this.DetailsBox.Name       = "DetailsBox";
            this.DetailsBox.ScrollBars = ScrollBars.Vertical;
            this.DetailsBox.Size       = new System.Drawing.Size(329, 184);
            this.DetailsBox.TabIndex   = 0;
            this.FeaturesPage.Controls.Add(this.FeatureList);
            this.FeaturesPage.Controls.Add(this.FeatureToolbar);
            this.FeaturesPage.Location = new Point(4, 22);
            this.FeaturesPage.Name     = "FeaturesPage";
            this.FeaturesPage.Padding  = new System.Windows.Forms.Padding(3);
            this.FeaturesPage.Size     = new System.Drawing.Size(341, 222);
            this.FeaturesPage.TabIndex = 2;
            this.FeaturesPage.Text     = "Features";
            this.FeaturesPage.UseVisualStyleBackColor = true;
            this.FeatureList.Columns.AddRange(new ColumnHeader[] { this.FeatureHdr });
            this.FeatureList.Dock          = DockStyle.Fill;
            this.FeatureList.FullRowSelect = true;
            this.FeatureList.HeaderStyle   = ColumnHeaderStyle.Nonclickable;
            this.FeatureList.HideSelection = false;
            this.FeatureList.Location      = new Point(3, 28);
            this.FeatureList.MultiSelect   = false;
            this.FeatureList.Name          = "FeatureList";
            this.FeatureList.Size          = new System.Drawing.Size(335, 191);
            this.FeatureList.TabIndex      = 1;
            this.FeatureList.UseCompatibleStateImageBehavior = false;
            this.FeatureList.View         = View.Details;
            this.FeatureList.DoubleClick += new EventHandler(this.FeatureEditBtn_Click);
            this.FeatureHdr.Text          = "Feature";
            this.FeatureHdr.Width         = 300;
            ToolStripItemCollection items = this.FeatureToolbar.Items;

            ToolStripItem[] featureAddBtn = new ToolStripItem[] { this.FeatureAddBtn, this.FeatureRemoveBtn, this.FeatureEditBtn };
            items.AddRange(featureAddBtn);
            this.FeatureToolbar.Location             = new Point(3, 3);
            this.FeatureToolbar.Name                 = "FeatureToolbar";
            this.FeatureToolbar.Size                 = new System.Drawing.Size(335, 25);
            this.FeatureToolbar.TabIndex             = 0;
            this.FeatureToolbar.Text                 = "toolStrip1";
            this.FeatureAddBtn.DisplayStyle          = ToolStripItemDisplayStyle.Text;
            this.FeatureAddBtn.Image                 = (Image)componentResourceManager.GetObject("FeatureAddBtn.Image");
            this.FeatureAddBtn.ImageTransparentColor = Color.Magenta;
            this.FeatureAddBtn.Name                     = "FeatureAddBtn";
            this.FeatureAddBtn.Size                     = new System.Drawing.Size(33, 22);
            this.FeatureAddBtn.Text                     = "Add";
            this.FeatureAddBtn.Click                   += new EventHandler(this.FeatureAddBtn_Click);
            this.FeatureRemoveBtn.DisplayStyle          = ToolStripItemDisplayStyle.Text;
            this.FeatureRemoveBtn.Image                 = (Image)componentResourceManager.GetObject("FeatureRemoveBtn.Image");
            this.FeatureRemoveBtn.ImageTransparentColor = Color.Magenta;
            this.FeatureRemoveBtn.Name                  = "FeatureRemoveBtn";
            this.FeatureRemoveBtn.Size                  = new System.Drawing.Size(54, 22);
            this.FeatureRemoveBtn.Text                  = "Remove";
            this.FeatureRemoveBtn.Click                += new EventHandler(this.FeatureRemoveBtn_Click);
            this.FeatureEditBtn.DisplayStyle            = ToolStripItemDisplayStyle.Text;
            this.FeatureEditBtn.Image                   = (Image)componentResourceManager.GetObject("FeatureEditBtn.Image");
            this.FeatureEditBtn.ImageTransparentColor   = Color.Magenta;
            this.FeatureEditBtn.Name                    = "FeatureEditBtn";
            this.FeatureEditBtn.Size                    = new System.Drawing.Size(31, 22);
            this.FeatureEditBtn.Text                    = "Edit";
            this.FeatureEditBtn.Click                  += new EventHandler(this.FeatureEditBtn_Click);
            this.PowersPage.Controls.Add(this.PowerList);
            this.PowersPage.Controls.Add(this.PowerToolbar);
            this.PowersPage.Location = new Point(4, 22);
            this.PowersPage.Name     = "PowersPage";
            this.PowersPage.Padding  = new System.Windows.Forms.Padding(3);
            this.PowersPage.Size     = new System.Drawing.Size(341, 222);
            this.PowersPage.TabIndex = 3;
            this.PowersPage.Text     = "Powers";
            this.PowersPage.UseVisualStyleBackColor = true;
            this.PowerList.Columns.AddRange(new ColumnHeader[] { this.PowerHdr });
            this.PowerList.Dock          = DockStyle.Fill;
            this.PowerList.FullRowSelect = true;
            this.PowerList.HeaderStyle   = ColumnHeaderStyle.Nonclickable;
            this.PowerList.HideSelection = false;
            this.PowerList.Location      = new Point(3, 28);
            this.PowerList.MultiSelect   = false;
            this.PowerList.Name          = "PowerList";
            this.PowerList.Size          = new System.Drawing.Size(335, 191);
            this.PowerList.TabIndex      = 2;
            this.PowerList.UseCompatibleStateImageBehavior = false;
            this.PowerList.View         = View.Details;
            this.PowerList.DoubleClick += new EventHandler(this.PowerEditBtn_Click);
            this.PowerHdr.Text          = "Feature";
            this.PowerHdr.Width         = 300;
            ToolStripItemCollection toolStripItemCollections = this.PowerToolbar.Items;

            ToolStripItem[] powerAddBtn = new ToolStripItem[] { this.PowerAddBtn, this.PowerRemoveBtn, this.PowerEditBtn };
            toolStripItemCollections.AddRange(powerAddBtn);
            this.PowerToolbar.Location             = new Point(3, 3);
            this.PowerToolbar.Name                 = "PowerToolbar";
            this.PowerToolbar.Size                 = new System.Drawing.Size(335, 25);
            this.PowerToolbar.TabIndex             = 1;
            this.PowerToolbar.Text                 = "toolStrip2";
            this.PowerAddBtn.DisplayStyle          = ToolStripItemDisplayStyle.Text;
            this.PowerAddBtn.Image                 = (Image)componentResourceManager.GetObject("PowerAddBtn.Image");
            this.PowerAddBtn.ImageTransparentColor = Color.Magenta;
            this.PowerAddBtn.Name                     = "PowerAddBtn";
            this.PowerAddBtn.Size                     = new System.Drawing.Size(33, 22);
            this.PowerAddBtn.Text                     = "Add";
            this.PowerAddBtn.Click                   += new EventHandler(this.PowerAddBtn_Click);
            this.PowerRemoveBtn.DisplayStyle          = ToolStripItemDisplayStyle.Text;
            this.PowerRemoveBtn.Image                 = (Image)componentResourceManager.GetObject("PowerRemoveBtn.Image");
            this.PowerRemoveBtn.ImageTransparentColor = Color.Magenta;
            this.PowerRemoveBtn.Name                  = "PowerRemoveBtn";
            this.PowerRemoveBtn.Size                  = new System.Drawing.Size(54, 22);
            this.PowerRemoveBtn.Text                  = "Remove";
            this.PowerRemoveBtn.Click                += new EventHandler(this.PowerRemoveBtn_Click);
            this.PowerEditBtn.DisplayStyle            = ToolStripItemDisplayStyle.Text;
            this.PowerEditBtn.Image                   = (Image)componentResourceManager.GetObject("PowerEditBtn.Image");
            this.PowerEditBtn.ImageTransparentColor   = Color.Magenta;
            this.PowerEditBtn.Name                    = "PowerEditBtn";
            this.PowerEditBtn.Size                    = new System.Drawing.Size(31, 22);
            this.PowerEditBtn.Text                    = "Edit";
            this.PowerEditBtn.Click                  += new EventHandler(this.PowerEditBtn_Click);
            this.OKBtn.Anchor                      = AnchorStyles.Bottom | AnchorStyles.Right;
            this.OKBtn.DialogResult                = System.Windows.Forms.DialogResult.OK;
            this.OKBtn.Location                    = new Point(205, 292);
            this.OKBtn.Name                        = "OKBtn";
            this.OKBtn.Size                        = new System.Drawing.Size(75, 23);
            this.OKBtn.TabIndex                    = 3;
            this.OKBtn.Text                        = "OK";
            this.OKBtn.UseVisualStyleBackColor     = true;
            this.OKBtn.Click                      += new EventHandler(this.OKBtn_Click);
            this.CancelBtn.Anchor                  = AnchorStyles.Bottom | AnchorStyles.Right;
            this.CancelBtn.DialogResult            = System.Windows.Forms.DialogResult.Cancel;
            this.CancelBtn.Location                = new Point(286, 292);
            this.CancelBtn.Name                    = "CancelBtn";
            this.CancelBtn.Size                    = new System.Drawing.Size(75, 23);
            this.CancelBtn.TabIndex                = 4;
            this.CancelBtn.Text                    = "Cancel";
            this.CancelBtn.UseVisualStyleBackColor = true;
            this.QuoteLbl.Anchor                   = AnchorStyles.Bottom | AnchorStyles.Left;
            this.QuoteLbl.AutoSize                 = true;
            this.QuoteLbl.Location                 = new Point(6, 199);
            this.QuoteLbl.Name                     = "QuoteLbl";
            this.QuoteLbl.Size                     = new System.Drawing.Size(39, 13);
            this.QuoteLbl.TabIndex                 = 1;
            this.QuoteLbl.Text                     = "Quote:";
            this.QuoteBox.Anchor                   = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
            this.QuoteBox.Location                 = new Point(51, 196);
            this.QuoteBox.Name                     = "QuoteBox";
            this.QuoteBox.Size                     = new System.Drawing.Size(284, 20);
            this.QuoteBox.TabIndex                 = 2;
            base.AcceptButton                      = this.OKBtn;
            base.AutoScaleDimensions               = new SizeF(6f, 13f);
            base.AutoScaleMode                     = System.Windows.Forms.AutoScaleMode.Font;
            base.CancelButton                      = this.CancelBtn;
            base.ClientSize                        = new System.Drawing.Size(373, 327);
            base.Controls.Add(this.CancelBtn);
            base.Controls.Add(this.OKBtn);
            base.Controls.Add(this.Pages);
            base.Controls.Add(this.NameBox);
            base.Controls.Add(this.NameLbl);
            base.MaximizeBox   = false;
            base.MinimizeBox   = false;
            base.Name          = "OptionRaceForm";
            base.ShowIcon      = false;
            base.ShowInTaskbar = false;
            base.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
            base.StartPosition = FormStartPosition.CenterParent;
            this.Text          = "Race";
            this.Pages.ResumeLayout(false);
            this.TraitsPage.ResumeLayout(false);
            this.TraitsPage.PerformLayout();
            this.DetailsPage.ResumeLayout(false);
            this.DetailsPage.PerformLayout();
            this.FeaturesPage.ResumeLayout(false);
            this.FeaturesPage.PerformLayout();
            this.FeatureToolbar.ResumeLayout(false);
            this.FeatureToolbar.PerformLayout();
            this.PowersPage.ResumeLayout(false);
            this.PowersPage.PerformLayout();
            this.PowerToolbar.ResumeLayout(false);
            this.PowerToolbar.PerformLayout();
            base.ResumeLayout(false);
            base.PerformLayout();
        }
Пример #27
0
 public MenuStripItemCollection(ToolStripItemCollection items, IMenuIndex menuIndex)
     : base(items, menuIndex)
 {
 }
Пример #28
0
        private void InitializeComponent()
        {
            ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(OverviewForm));

            this.Toolbar      = new ToolStrip();
            this.EncounterBtn = new ToolStripButton();
            this.TrapBtn      = new ToolStripButton();
            this.ChallengeBtn = new ToolStripButton();
            this.TreasureBtn  = new ToolStripButton();
            this.ItemList     = new ListView();
            this.PointHdr     = new ColumnHeader();
            this.InfoHdr      = new ColumnHeader();
            this.MainPanel    = new Panel();
            this.CloseBtn     = new Button();
            this.Toolbar.SuspendLayout();
            this.MainPanel.SuspendLayout();
            base.SuspendLayout();
            ToolStripItemCollection items = this.Toolbar.Items;

            ToolStripItem[] encounterBtn = new ToolStripItem[] { this.EncounterBtn, this.TrapBtn, this.ChallengeBtn, this.TreasureBtn };
            items.AddRange(encounterBtn);
            this.Toolbar.Location                   = new Point(0, 0);
            this.Toolbar.Name                       = "Toolbar";
            this.Toolbar.Size                       = new System.Drawing.Size(513, 25);
            this.Toolbar.TabIndex                   = 0;
            this.Toolbar.Text                       = "toolStrip1";
            this.EncounterBtn.DisplayStyle          = ToolStripItemDisplayStyle.Text;
            this.EncounterBtn.Image                 = (Image)componentResourceManager.GetObject("EncounterBtn.Image");
            this.EncounterBtn.ImageTransparentColor = Color.Magenta;
            this.EncounterBtn.Name                  = "EncounterBtn";
            this.EncounterBtn.Size                  = new System.Drawing.Size(70, 22);
            this.EncounterBtn.Text                  = "Encounters";
            this.EncounterBtn.Click                += new EventHandler(this.EncounterBtn_Click);
            this.TrapBtn.DisplayStyle               = ToolStripItemDisplayStyle.Text;
            this.TrapBtn.Image                      = (Image)componentResourceManager.GetObject("TrapBtn.Image");
            this.TrapBtn.ImageTransparentColor      = Color.Magenta;
            this.TrapBtn.Name                       = "TrapBtn";
            this.TrapBtn.Size                       = new System.Drawing.Size(40, 22);
            this.TrapBtn.Text                       = "Traps";
            this.TrapBtn.Click                     += new EventHandler(this.TrapBtn_Click);
            this.ChallengeBtn.DisplayStyle          = ToolStripItemDisplayStyle.Text;
            this.ChallengeBtn.Image                 = (Image)componentResourceManager.GetObject("ChallengeBtn.Image");
            this.ChallengeBtn.ImageTransparentColor = Color.Magenta;
            this.ChallengeBtn.Name                  = "ChallengeBtn";
            this.ChallengeBtn.Size                  = new System.Drawing.Size(93, 22);
            this.ChallengeBtn.Text                  = "Skill Challenges";
            this.ChallengeBtn.Click                += new EventHandler(this.ChallengeBtn_Click);
            this.TreasureBtn.DisplayStyle           = ToolStripItemDisplayStyle.Text;
            this.TreasureBtn.Image                  = (Image)componentResourceManager.GetObject("TreasureBtn.Image");
            this.TreasureBtn.ImageTransparentColor  = Color.Magenta;
            this.TreasureBtn.Name                   = "TreasureBtn";
            this.TreasureBtn.Size                   = new System.Drawing.Size(56, 22);
            this.TreasureBtn.Text                   = "Treasure";
            this.TreasureBtn.Click                 += new EventHandler(this.TreasureBtn_Click);
            ListView.ColumnHeaderCollection columns = this.ItemList.Columns;
            ColumnHeader[] pointHdr = new ColumnHeader[] { this.PointHdr, this.InfoHdr };
            columns.AddRange(pointHdr);
            this.ItemList.Dock          = DockStyle.Fill;
            this.ItemList.FullRowSelect = true;
            this.ItemList.HeaderStyle   = ColumnHeaderStyle.Nonclickable;
            this.ItemList.HideSelection = false;
            this.ItemList.Location      = new Point(0, 25);
            this.ItemList.MultiSelect   = false;
            this.ItemList.Name          = "ItemList";
            this.ItemList.Size          = new System.Drawing.Size(513, 203);
            this.ItemList.TabIndex      = 1;
            this.ItemList.UseCompatibleStateImageBehavior = false;
            this.ItemList.View         = View.Details;
            this.ItemList.DoubleClick += new EventHandler(this.ItemList_DoubleClick);
            this.PointHdr.Text         = "Point";
            this.PointHdr.Width        = 100;
            this.InfoHdr.Text          = "Information";
            this.InfoHdr.Width         = 384;
            this.MainPanel.Anchor      = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
            this.MainPanel.Controls.Add(this.ItemList);
            this.MainPanel.Controls.Add(this.Toolbar);
            this.MainPanel.Location               = new Point(12, 12);
            this.MainPanel.Name                   = "MainPanel";
            this.MainPanel.Size                   = new System.Drawing.Size(513, 228);
            this.MainPanel.TabIndex               = 2;
            this.CloseBtn.Anchor                  = AnchorStyles.Bottom | AnchorStyles.Right;
            this.CloseBtn.DialogResult            = System.Windows.Forms.DialogResult.OK;
            this.CloseBtn.Location                = new Point(450, 246);
            this.CloseBtn.Name                    = "CloseBtn";
            this.CloseBtn.Size                    = new System.Drawing.Size(75, 23);
            this.CloseBtn.TabIndex                = 3;
            this.CloseBtn.Text                    = "Close";
            this.CloseBtn.UseVisualStyleBackColor = true;
            base.AcceptButton        = this.CloseBtn;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode       = System.Windows.Forms.AutoScaleMode.Font;
            base.ClientSize          = new System.Drawing.Size(537, 281);
            base.Controls.Add(this.CloseBtn);
            base.Controls.Add(this.MainPanel);
            base.MinimizeBox   = false;
            base.Name          = "OverviewForm";
            base.ShowIcon      = false;
            base.ShowInTaskbar = false;
            base.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
            base.StartPosition = FormStartPosition.CenterParent;
            this.Text          = "Project Overview";
            this.Toolbar.ResumeLayout(false);
            this.Toolbar.PerformLayout();
            this.MainPanel.ResumeLayout(false);
            this.MainPanel.PerformLayout();
            base.ResumeLayout(false);
        }
Пример #29
0
        public static void BuildToolBar(ToolStrip tb, ToolStripItemCollection mi, System.Collections.ArrayList exclude)
        {
            System.Collections.Generic.List <ToolStripItemCollection> submenus = new System.Collections.Generic.List <ToolStripItemCollection>();
            System.Collections.Generic.List <ToolStripMenuItem>       items    = new System.Collections.Generic.List <ToolStripMenuItem>();
            System.Collections.Generic.List <ToolStripMenuItem>       starters = new System.Collections.Generic.List <ToolStripMenuItem>();

            for (int i = mi.Count - 1; i >= 0; i--)
            {
                ToolStripMenuItem tsmi = mi[i] as ToolStripMenuItem;
                if (tsmi == null)
                {
                    if (i < mi.Count - 1)
                    {
                        starters.Add(mi[i + 1] as ToolStripMenuItem);
                    }
                    continue;
                }
                if (tsmi.DropDownItems.Count > 0)
                {
                    submenus.Add(tsmi.DropDownItems);
                }
                else
                {
                    ToolStripMenuItem item = tsmi;
                    if (exclude.Contains(item))
                    {
                        continue;
                    }
                    if (item.Image == null)
                    {
                        items.Add(item);
                    }
                    else
                    {
                        items.Insert(0, item);
                    }
                }
            }

            System.Collections.Generic.List <int> groupindices = new System.Collections.Generic.List <int>();
            for (int i = 0; i < items.Count; i++)
            {
                ToolStripMenuItem item = items[i];
                ToolStripButton   bi   = new MyButtonItem(item);
                bool beggroup          = (i == 0 && tb.Items.Count > 0) || starters.Contains(item);;
                if (beggroup)
                {
                    groupindices.Add(i);
                }
                tb.Items.Add(bi);
            }

            //// RECHECK
            foreach (int i in groupindices)
            {
                ToolStripMenuItem bi = new ToolStripMenuItem("--");
                items.Insert(i, bi);
            }


            for (int i = 0; i < submenus.Count; i++)
            {
                BuildToolBar(tb, submenus[i], exclude);
            }
        }
Пример #30
0
        private void AttachSettingHooks(IToolFormAutoConfig tool, ToolDialogSettings settings)
        {
            var form = (Form)tool;
            ToolStripItemCollection dest = null;
            var oldsize = form.Size;             // this should be the right time to grab this size

            foreach (Control c in form.Controls)
            {
                if (c is MenuStrip)
                {
                    var ms = c as MenuStrip;
                    foreach (ToolStripMenuItem submenu in ms.Items)
                    {
                        if (submenu.Text.Contains("Settings"))
                        {
                            dest = submenu.DropDownItems;
                            dest.Add(new ToolStripSeparator());
                            break;
                        }
                    }

                    if (dest == null)
                    {
                        var submenu = new ToolStripMenuItem("&Settings");
                        ms.Items.Add(submenu);
                        dest = submenu.DropDownItems;
                    }

                    break;
                }
            }

            if (dest == null)
            {
                throw new InvalidOperationException("IToolFormAutoConfig must have menu to bind to!");
            }

            int idx = dest.Count;

            dest.Add("Save Window &Position");
            dest.Add("Stay on &Top");
            dest.Add("&Float from Parent");
            dest.Add("&Autoload");
            dest.Add("Restore &Defaults");

            RefreshSettings(form, dest, settings, idx);

            if (settings.UseWindowPosition && IsOnScreen(settings.TopLeft))
            {
                form.StartPosition = FormStartPosition.Manual;
                form.Location      = settings.WindowPosition;
            }

            if (settings.UseWindowSize)
            {
                if (form.FormBorderStyle == FormBorderStyle.Sizable || form.FormBorderStyle == FormBorderStyle.SizableToolWindow)
                {
                    form.Size = settings.WindowSize;
                }
            }

            form.FormClosing += (o, e) =>
            {
                if (form.WindowState == FormWindowState.Normal)
                {
                    settings.Wndx = form.Location.X;
                    settings.Wndy = form.Location.Y;
                    if (settings.Wndx < 0)
                    {
                        settings.Wndx = 0;
                    }

                    if (settings.Wndy < 0)
                    {
                        settings.Wndy = 0;
                    }

                    settings.Width  = form.Right - form.Left;                    // why not form.Size.Width?
                    settings.Height = form.Bottom - form.Top;
                }
            };

            dest[idx + 0].Click += (o, e) =>
            {
                bool val = !((ToolStripMenuItem)o).Checked;
                settings.SaveWindowPosition    = val;
                ((ToolStripMenuItem)o).Checked = val;
            };
            dest[idx + 1].Click += (o, e) =>
            {
                bool val = !((ToolStripMenuItem)o).Checked;
                settings.TopMost = val;
                ((ToolStripMenuItem)o).Checked = val;
                form.TopMost = val;
            };
            dest[idx + 2].Click += (o, e) =>
            {
                bool val = !((ToolStripMenuItem)o).Checked;
                settings.FloatingWindow        = val;
                ((ToolStripMenuItem)o).Checked = val;
                form.Owner = val ? null : _owner;
            };
            dest[idx + 3].Click += (o, e) =>
            {
                bool val = !((ToolStripMenuItem)o).Checked;
                settings.AutoLoad = val;
                ((ToolStripMenuItem)o).Checked = val;
            };
            dest[idx + 4].Click += (o, e) =>
            {
                settings.RestoreDefaults();
                RefreshSettings(form, dest, settings, idx);
                form.Size = oldsize;
            };
        }
 public void AddRange(ToolStripItemCollection toolStripItems)
 {
 }
Пример #32
0
 protected static List<ToolStripItem> GetVisibleToolStripItems(ToolStripItemCollection items)
 {
     return Util.PopulateList<ToolStripItem>(items).FindAll(t => t.Available);
 }