/// <summary> /// Add item. /// </summary> /// <param name="item">Item to add.</param> public void AddItem(sbutton item) { item.Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left; item.Size = new Size(Width - 2, 30); item.Location = new Point(2, Controls.Count * 30); item.BackColor = BackColor; item.ForeColor = ForeColor; item.MouseEnterColor = Color.Gray; item.MouseDownColor = Color.DodgerBlue; item.Image = Resources.Database; item.Tag2 = "Database"; item.Click += item_Click; Grid.Controls.Add((cncpanel)item.Tag); Controls.Add(item); CurrentItem = item; }
private void Tab_SelectedIndexChanged(object sender, EventArgs e) { var form = (Studio)Parent.Parent; if (form.titlePanel.Controls.ContainsKey("mhqlButton")) { var mhqlButton = form.titlePanel.Controls[form.titlePanel.Controls.IndexOfKey("mhqlButton")] as sbutton; mhqlButton.ContextMenu.Dispose(); mhqlButton.Dispose(); form.helpButton.Location = new Point( form.connectionButton.Location.X + form.connectionButton.Width, 0); } /*if(tab.SelectedTab == dashboardPage) { * refreshDashboard(); * } else */ if (tab.SelectedTab == explorerPage) { if (reshExplorer) { refreshExplorer(); } } else if (tab.SelectedTab == terminalPage) { term.Select(); } else if (tab.SelectedTab == mhqlPage) { #region mhqlCM var mhqlCM = new sContextMenu(); mhqlCM.ForeColor = Color.White; mhqlCM.BackColor = Color.FromArgb(24, 24, 24); mhqlCM.Items.Add(new sContextMenuItem("Run", mhqlCM.BackColor, Color.Gray) { Image = Resources.Play, ShortcutKeyDisplayString = "F5" }); mhqlCM.ItemClicked += (object mhqlCM_Sender, ToolStripItemClickedEventArgs mhqlCM_e) => { if (mhqlCM_e.ClickedItem.Text == "Run") { ExecuteMHQL(); } }; #endregion #region mhqlButton var mhqlButton = new sbutton(); mhqlButton.Name = "mhqlButton"; mhqlButton.Font = new Font("Microsoft Sans Serif", 9); mhqlButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Top; mhqlButton.Text = "MHQL"; mhqlButton.ForeColor = Color.White; mhqlButton.BackColor = mhqlCM.BackColor; mhqlButton.MouseEnterColor = Color.Gray; mhqlButton.MouseDownColor = Color.DodgerBlue; mhqlButton.Location = new Point(form.connectionButton.Location.X + form.connectionButton.Width, 0); mhqlButton.Size = new Size(70, 30); mhqlButton.ContextMenu = mhqlCM; mhqlButton.DisableClick = true; #endregion form.helpButton.Location = new Point(mhqlButton.Location.X + mhqlButton.Width, 0); form.titlePanel.Controls.Add(mhqlButton); if (reshMHQL) { refreshMHQL(); } } else if (tab.SelectedTab == settingsPage) { refreshSettings(); } }