public TabControl RenderForm(Control doc, List <Control> ucData, string tabPageName, string tabPageText, TabControl tc) { _objCb.CreatePanel(new Panel(), tc, 0, DockStyle.Fill, doc, true); var tp = new TabPage() { Name = tabPageName, Text = tabPageText, BackColor = Color.White, AutoScroll = true }; tc.Controls.Add(tp); var i = 1; foreach (Control u in ucData.AsEnumerable().Reverse()) { if ((u is UcSubmit) || (u is UcPassFail)) { _objCb.CreatePanel(new Panel(), u, i, DockStyle.Bottom, doc, true); } else { u.Dock = DockStyle.Top; tp.Controls.Add(u); u.Show(); } i = i + 1; } tp.AutoScroll = true; tc.SelectTab(tp); _objCb.FindAndSetFocusOnTabIndex(tp); tc.BringToFront(); return(tc); }
/// <summary> /// 页签新增 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Tab_Add_Click(object sender, EventArgs e) { FrmTabAdd frm = new FrmTabAdd(); frm.ShowDialog(); string _tabName = frm.m_tabName; if (_tabName.Trim() == "") { return; } if ((this.formDesignerHost.RootComponent as Form).Controls.Find(TabControlName, true).Length > 0) { TabControl tc = ((this.formDesignerHost.RootComponent as Form).Controls.Find(TabControlName, true)[0] as TabControl); tc.TabPages.Add(_tabName, _tabName); tc.BringToFront(); //置前 } else { Type controlType = typeof(TabControl); Control control = this.formDesignerHost.CreateComponent(controlType) as Control; control.Name = TabControlName; control.Text = TabControlName; control.Location = new Point(5, System.Environment.TickCount % 200); (this.formDesignerHost.RootComponent as Form).Controls.Add(control); (control as TabControl).TabPages.Add(_tabName, _tabName); control.BringToFront(); //置前 } }
/// <summary> /// 基础面板Ctor /// </summary> /// <param name="Main"></param> public ComponentPanel(bool Main = false) { _mbMain = Main; TabCtrl = new TabControl(); TabCtrl.Dock = DockStyle.Fill; TabCtrl.BringToFront(); this.Controls.Add(TabCtrl); }
private void InitializeContent() { #region Status ToolStripStatusLabel Tulajdonos = new ToolStripStatusLabel("Turul Koppány Íjászai HE, Hunvér Kft."); ToolStripStatusLabel Készítők = new ToolStripStatusLabel("©Belinyák Nándor és Társai."); Készítők.BorderSides = ToolStripStatusLabelBorderSides.Left; status = new StatusStrip(); status.Items.Add(Tulajdonos); status.Items.Add(Készítők); #endregion #region Menu TabPage Induló = new TabPage("Induló"); induló_panel = new Panel_Induló(); induló_panel.Dock = DockStyle.Fill; Induló.Controls.Add(induló_panel); TabPage Eredmény = new TabPage("Eredmény"); eredmény_panel = new Panel_Eredmény(); eredmény_panel.Dock = DockStyle.Fill; Eredmény.Controls.Add(eredmény_panel); // menu = new TabControl(); menu.TabPages.Add(Induló); menu.TabPages.Add(Eredmény); menu.DrawItem += menu_DrawItem; menu.DrawMode = TabDrawMode.OwnerDrawFixed; menu.Padding = new Point(18, 5); menu.Dock = DockStyle.Fill; #endregion Controls.Add(status); Controls.Add(menu); menu.BringToFront(); }
/// <summary> /// Setup Application /// </summary> /// <param name="tabControl1"></param> /// <param name="listView1"></param> /// <param name="listView2"></param> /// <param name="treeView1"></param> /// <param name="imageList1"></param> /// <returns></returns> public bool setupApplication(TabControl tabControl1, ListView listView1, ListView listView2, TreeView treeView1, ImageList imageList1) { //Bring TabControl to Front tabControl1.BringToFront(); //Load Default TreeView treeView1.ImageList = imageList1; //Add Columns listView1.View = View.Details; listView2.View = View.Details; int width = listView1.Width / 3; listView1.Columns.Add("Object", width, HorizontalAlignment.Left); listView1.Columns.Add("Invoke", width, HorizontalAlignment.Left); listView1.Columns.Add("Attributes", width, HorizontalAlignment.Left); listView2.Columns.Add("Objects", ((listView2.Width - 20) / 2), HorizontalAlignment.Left); listView2.Columns.Add("Type", ((listView2.Width - 20) / 2), HorizontalAlignment.Left); //Return listView2TEMP = listView2; return(true); }
private void loadTab(TabControl mainTabControl, string tabName, int tabNumber) { mainTabControl.TabPages.Add(tabName, tabName); TabPage tab = mainTabControl.TabPages[tabName]; tab.Controls.Clear(); SplitContainer mainPanel = new SplitContainer(); mainPanel.Orientation = Orientation.Horizontal; mainPanel.Dock = DockStyle.Fill; mainPanel.SplitterDistance = 5; tab.Controls.Add(mainPanel); FlowLayoutPanel flowPanel = new FlowLayoutPanel(); flowPanel.Dock = DockStyle.Fill; mainPanel.Panel1.Controls.Add(flowPanel); Label label = new Label(); label.Text = "Name of this Event :"; flowPanel.Controls.Add(label); TextBox tb = new TextBox(); tb.TextChanged += new EventHandler(tb_TextChanged); tb.Text = "New" + (m_isKnockout?"Knockout":"Swiss") + "_" + tabNumber; tb.Name = "eventNameTextbox_" + tabNumber; flowPanel.Controls.Add(tb); TabControl subTabControl = new TabControl(); subTabControl.Dock = DockStyle.Fill; subTabControl.BringToFront(); mainPanel.Panel2.Controls.Add(subTabControl); int tabCount = 1; foreach (string eventName in m_selectedEventNames) { loadSubTab(subTabControl, eventName, tabNumber, tabCount++); } }
public InventoryControl(GameScreen screen, Manager manager) : base(manager) { this.screen = screen; // Block images. blockImages = new ImageBox[inventorySlots]; selectImages = new ImageBox[inventorySlots]; normalWidth = ((inventorySlots + 1) * (Tile.Width + 2)) + 8; realWidth = Width = normalWidth; realHeight = Height = normalHeight; Left = Manager.TargetWidth / 2 - (Width / 2); Top = 0; Height += 1; // Background "gradient" image // TODO: Make an actual control. not a statusbar gradient = new StatusBar(manager); gradient.Init(); gradient.Width = Width; gradient.Height = Height; Add(gradient); // Create images. for (var i = 0; i < blockImages.Length; i++) { // Block icon image. blockImages[i] = new ImageBox(Manager) { Top = 4, // Center. Left = 12 + (Width / 2) - (((inventorySlots + 1) * (Tile.Width + 4)) / 2) + ((Tile.Width + 4) * i), Width = Tile.Width, Height = Tile.Width, Text = "", Passive = false }; // Select/border image. selectImages[i] = new ImageBox(Manager) { Top = 3, Left = 12 + (Width / 2) - (((inventorySlots + 1) * (Tile.Width + 4)) / 2) + ((Tile.Width + 4) * i) - 1, Width = Tile.Width + 2, Height = Tile.Width + 2, Text = "", Alpha = 128f, }; blockImages[i].Init(); selectImages[i].Init(); selectImages[i].Image = screen.Client.Content["gui.blockoutline"]; if (i < BlockType.Blocks.Count && BlockType.Blocks[i].IsRenderable) { blockImages[i].Image = BlockType.Blocks[i].Texture; blockImages[i].ToolTipType = typeof(BlockToolTip); ((BlockToolTip)blockImages[i].ToolTip).SetBlock(BlockType.Blocks[i]); } blockImages[i].SourceRect = BlockType.SourceRect; Add(selectImages[i]); Add(blockImages[i]); } SelectBlock(1); tabControl = new TabControl(Manager) { Left = 8, Top = 3 + Tile.FullHeight + 3, }; tabControl.Init(); tabControl.AddPage("Blocks"); tabControl.AddPage("Interactive"); tabControl.AddPage("Miscellaneous"); Add(tabControl); tabControl.BringToFront(); }
private void InitializeContent() { #region Status ToolStripStatusLabel Tulajdonos = new ToolStripStatusLabel(Program.Tulajdonos_Megnevezés); ToolStripStatusLabel Készítők = new ToolStripStatusLabel("Belinyák Nándor és Társai. \u00A9 2014"); ToolStripStatusLabel Verzió = new ToolStripStatusLabel("Verzió: 0.9.9-2017.06.13"); Készítők.BorderSides = ToolStripStatusLabelBorderSides.Left; Verzió.BorderSides = ToolStripStatusLabelBorderSides.Left; status = new StatusStrip(); status.Items.Add(Tulajdonos); status.Items.Add(Készítők); status.Items.Add(Verzió); #endregion #region Menü TabPage Versenysorozat = new TabPage("Versenysorozatok"); versenysorozat_panel = new Panel_Versenysorozat(); versenysorozat_panel.Dock = DockStyle.Fill; Versenysorozat.Controls.Add(versenysorozat_panel); TabPage Verseny = new TabPage("Versenyek"); verseny_panel = new Panel_Verseny(); verseny_panel.Dock = DockStyle.Fill; Verseny.Controls.Add(verseny_panel); TabPage Korosztályok = new TabPage("Korosztályok"); korosztályok_panel = new Panel_Korosztályok(); korosztályok_panel.Dock = DockStyle.Fill; Korosztályok.Controls.Add(korosztályok_panel); TabPage Íjtípusok = new TabPage("Íjtípusok"); íjtípusok_panel = new Panel_Íjtípusok(); íjtípusok_panel.Dock = DockStyle.Fill; Íjtípusok.Controls.Add(íjtípusok_panel); TabPage Egyesuletek = new TabPage("Egyesületek"); egyesuletek_panel = new Panel_Egyesuletek(); egyesuletek_panel.Dock = DockStyle.Fill; Egyesuletek.Controls.Add(egyesuletek_panel); TabPage Indulók = new TabPage("Indulók"); indulók_panel = new Panel_Indulók(); indulók_panel.Dock = DockStyle.Fill; Indulók.Controls.Add(indulók_panel); TabPage Eredmények = new TabPage("Eredmények"); eredmények_panel = new Panel_Eredmények(); eredmények_panel.Dock = DockStyle.Fill; Eredmények.Controls.Add(eredmények_panel); TabPage Kapcsolatok = new TabPage("Kapcsolatok"); kapcsolatok_panel = new Panel_Kapcsolatok(); kapcsolatok_panel.Dock = DockStyle.Fill; Kapcsolatok.Controls.Add(kapcsolatok_panel); TabPage Startlista = new TabPage("Startlisták"); startlista_panel = new Panel_Startlista(); startlista_panel.Dock = DockStyle.Fill; Startlista.Controls.Add(startlista_panel); TabPage Eredménylap = new TabPage("Eredménylapok"); eredménylap_panel = new Panel_Eredménylap(); eredménylap_panel.Dock = DockStyle.Fill; Eredménylap.Controls.Add(eredménylap_panel); TabPage Oklevelek = new TabPage("Oklevelek"); oklevelek_panel = new Panel_Oklevelek(); oklevelek_panel.Dock = DockStyle.Fill; Oklevelek.Controls.Add(oklevelek_panel); // menu = new TabControl(); menu.TabPages.Add(Versenysorozat); menu.TabPages.Add(Verseny); menu.TabPages.Add(Korosztályok); menu.TabPages.Add(Íjtípusok); menu.TabPages.Add(Egyesuletek); menu.TabPages.Add(Indulók); menu.TabPages.Add(Eredmények); menu.TabPages.Add(Startlista); menu.TabPages.Add(Eredménylap); menu.TabPages.Add(Oklevelek); //menu.TabPages.Add(Kapcsolatok); #if DEBUG menu.SelectedTab = Oklevelek; #endif menu.DrawItem += menu_DrawItem; menu.DrawMode = TabDrawMode.OwnerDrawFixed; menu.Padding = new Point(18, 5); menu.Dock = DockStyle.Fill; #endregion Button BackupButton = new Button(); BackupButton.Text = "Mentés"; BackupButton.Location = new Point(ClientSize.Width - 64, 0); BackupButton.Size = new System.Drawing.Size(64, 24); BackupButton.Anchor = AnchorStyles.Right | AnchorStyles.Top; BackupButton.Click += BackupButton_Click; Controls.Add(status); Controls.Add(menu); menu.BringToFront(); Controls.Add(BackupButton); BackupButton.BringToFront(); }
private void FormFoodChoices_Load(object sender, EventArgs e) { #region Dymamic Menu TabControl tab = new TabControl(); var listCategory = Category.GetListCategory(); tab.Location = new Point(10, 65); tab.Size = new Size(555, 445); tab.Font = new Font("UTM Bebas", 12, FontStyle.Regular); for (int i = 0; i < listCategory.Count; i++) { TabPage tp = new TabPage(listCategory[i].Name); tp.Location = new Point(10, 58); tp.BackColor = Color.Transparent; var listFood = Food.GetFoodByCategory(listCategory[i].ID); FlowLayoutPanel fl = new FlowLayoutPanel(); fl.Location = new Point(0, 0); fl.BackColor = Color.Transparent; fl.AutoScroll = true; fl.Dock = DockStyle.Fill; for (int j = 0; j < listFood.Count; j++) { Panel pn = new Panel(); pn.Size = new Size(170, 250); pn.BackColor = Color.DarkGray; PictureBox pc = new PictureBox(); pc.Location = new Point(20, 10); pc.Size = new Size(130, 120); // if (listFood[j].Image == null) pc.Image = Image.FromFile(@"C:\Users\Admin\Desktop\Food\bia-tiger-lon-01.jpg"); //else pc.Image = Image.FromFile(listFood[j].Image); pc.SizeMode = PictureBoxSizeMode.StretchImage; Label name = new Label(); Label lbGia = new Label(); Label VND = new Label(); Label sl = new Label(); NumericUpDown numeric = new NumericUpDown(); Button btnChon = new Button(); Button btnBoChon = new Button(); btnChon.Text = "Chọn"; btnBoChon.Text = "Bỏ Chọn"; btnChon.Font = new Font("UTM Bebas", 10, FontStyle.Regular); btnBoChon.Font = new Font("UTM Bebas", 10, FontStyle.Regular); btnChon.Tag = listFood[j].ID; btnBoChon.Tag = listFood[j].ID; btnChon.Click += new EventHandler(this.chon_Click); btnBoChon.Click += new EventHandler(this.bochon_Click); btnBoChon.Size = new Size(55, 30); btnChon.Size = new Size(55, 30); btnChon.Location = new Point(30, pn.Height - 5 - btnChon.Height); btnBoChon.Location = new Point(30 + btnChon.Width, pn.Height - 5 - btnBoChon.Height); btnBoChon.BackColor = Color.Transparent; btnChon.BackColor = Color.Transparent; sl.Text = "Số Lượng"; sl.Location = new Point(btnChon.Location.X, btnChon.Location.Y - 25); sl.Size = new Size(60, 30); numeric.Value = 0; numeric.Name = "SL"; numeric.Font = new Font("UTM Bebas", 10, FontStyle.Regular); numeric.Size = new Size(50, 25); numeric.Location = new Point(sl.Location.X + sl.Width, sl.Location.Y); pn.Controls.Add(btnBoChon); pn.Controls.Add(btnChon); pn.Controls.Add(sl); pn.Controls.Add(numeric); lbGia.Text = String.Format("{0:n0}", listFood[j].Price); lbGia.Location = new Point(sl.Location.X, sl.Location.Y - sl.Height); pn.Controls.Add(lbGia); VND.Text = "VND"; VND.Location = new Point(numeric.Location.X + numeric.Width - 30, sl.Location.Y - sl.Height); pn.Controls.Add(pc); pn.Controls.Add(VND); VND.BringToFront(); name.Text = listFood[j].Name; name.Size = new Size(120, 20); name.Font = new Font("UTM Bebas", 10, FontStyle.Regular); name.Location = new Point(lbGia.Location.X, lbGia.Location.Y - lbGia.Height); name.TextAlign = ContentAlignment.MiddleCenter; pn.Controls.Add(name); fl.Controls.Add(pn); } tab.TabPages.Add(tp); tp.Controls.Add(fl); } this.Controls.Add(tab); tab.BringToFront(); #endregion ID_Bill = Bill.AddBill(EmployeeID); dataGridView1.ReadOnly = true; dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGridView1.AllowUserToAddRows = false; dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridView1.BackgroundColor = Color.White; dataGridView1.RowHeadersVisible = false; dataGridView1.DefaultCellStyle.Font = new Font("UTM", 10, FontStyle.Regular); }
protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); int x = e.X, y = e.Y; Rectangle myTabRect = new Rectangle(); Color bacColor = Color.White; bool isInCatogery = false; for (int i = 0; i < base.TabCount - 1; i++) {//计算关闭区域 myTabRect = this.GetTabRect(i); if (myTabRect.Contains(e.Location)) { if (base.SelectedIndex == i) { bacColor = Color.White; } else { bacColor = Color.CornflowerBlue; } isInCatogery = true; break; } } if (isInCatogery) { myTabRect.Offset(myTabRect.Width - (ICONSIZE + 3), 2); myTabRect.Width = ICONSIZE; myTabRect.Height = ICONSIZE; bool isClose = x > myTabRect.X && x <myTabRect.Right && y> myTabRect.Y && y < myTabRect.Bottom; if (isClose == true) { using (Pen objpen = new Pen(Color.Black)) { Icon bt = Properties.Resources.close_16px; Graphics g = base.CreateGraphics(); using (Brush b = new SolidBrush(bacColor)) { g.FillRectangle(b, myTabRect); } g.DrawIcon(bt, myTabRect); } } else { using (Pen objpen = new Pen(Color.Black)) { Icon bt = Properties.Resources.Close_16px_with_cirle; Graphics g = base.CreateGraphics(); using (Brush b = new SolidBrush(bacColor)) { g.FillRectangle(b, myTabRect); } g.DrawIcon(bt, myTabRect); } } } if (isDrag && !isMoving) { //当鼠标移动5px方圆再确定移动 if (e.Location.X - clickPoint.X > 10 || e.Location.Y - clickPoint.Y > 10 || e.Location.X - clickPoint.X < -10 || e.Location.Y - clickPoint.Y < -10) { canNew = false; isMoving = true; moveTab = new TabPage(); moveTab = base.SelectedTab; mp.leftToClick = base.GetTabRect(base.SelectedIndex).Left - e.Location.X; mp.topToClick = base.GetTabRect(base.SelectedIndex).Top - e.Location.Y; base.SelectedIndex = base.SelectedIndex - 1; base.TabPages.Remove(moveTab); moveTabControl = new TabControl(); base.Parent.Controls.Add(moveTabControl); moveTabControl.TabPages.Add(moveTab); moveTabControl.Left = moveTab.Left; moveTabControl.Top = moveTab.Top; moveTabControl.BringToFront(); } } if (isMoving) { moveTabControl.Left = e.Location.X + base.Left + mp.leftToClick; moveTabControl.Top = e.Location.Y + base.Top + mp.topToClick; } //controlSize.MyMouseMove(this,e); }