/// <summary> /// MyTableLayoutPanel的 保存 按钮事件 /// 保存device,signalType,chNO到数据库并刷新tabpage /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void tpl_save_Click(object sender, EventArgs e) { //throw new NotImplementedException(); //int nodeID, string device, string signalType, int chNO int nodeID; string nodeName; string device; string signalType; int chNO; Button save = (Button)sender; MyUserControl.MyTableLayoutPanel tlp = (MyUserControl.MyTableLayoutPanel)save.Parent; TabPage tp = (TabPage)tlp.Parent; MyUserControl.ClosableTabControl ctc = (MyUserControl.ClosableTabControl)tp.Parent; nodeID = System.Convert.ToInt32(tlp.lbl_nodeID.Text); nodeName = tlp.lbl_nodeName.Text; device = tlp.cmb_device.Text; signalType = tlp.cmb_signalType.Text; chNO = System.Convert.ToInt32(tlp.cmb_chNO.Text); new BusinessLogicLayer.MySystemsBLL().saveNodeInfo(nodeID, device, signalType, chNO); MessageBox.Show("保存成功!"); WaveformGraph wave = new WaveformGraph(); wave.Dock = DockStyle.Fill; WaveGraph_Init(wave, nodeName); ctc.PageUpdate(wave, nodeID, tabPageList); tp.Refresh(); }
private TabPage UpdateTab() { UpdateMenuItems(); TabPage tp = tabMapsCollection.SelectedTab; tp.Refresh(); return(tabMapsCollection.SelectedTab); }
void taoKhuVuc() { foreach (KhuVuc k in qlban.getAllKhuVuc()) { TabPage tp = new TabPage(k.MaKhuVuc); tp.Click += tp_Click; lstTabPage.Add(tp); tp.Width = this.Width / 2; tp.Text = k.MaKhuVuc; tp.BackColor = Color.Aqua; //qlban.getAllTableforArea(k.MaKhuVuc); foreach (Ban b in qlban.getAllTableforArea(k.MaKhuVuc)) { SimpleButton ban = new SimpleButton(); ban.Click += frmQuanLyKhu_Click; lstBan.Add(ban); lstBan[i].Size = new Size(50, 50); lstBan[i].BackColor = Color.Aqua; lstBan[i].Name = b.MaBan.ToString().Trim(); lstBan[i].Text = b.TenBan.ToString(); lstBan[i].ImageOptions.Location = ImageLocation.MiddleCenter; lstBan[i].AppearanceHovered.BackColor = Color.Red; lstBan[i].AppearancePressed.BackColor = Color.Pink; tp.Controls.Add(lstBan[i]); lstBan[i].ImageOptions.Image = global::AppQuanLyBanCafe.Properties.Resources.chuadat; if (i == temp) { lstBan[i].Location = new Point(30, 5); } else { if (lstBan[i - 1].Location.X + 150 > tp.Width) { lstBan[i].Location = new Point(30, lstBan[i - 1].Location.Y + 80); } else { lstBan[i].Location = new Point(lstBan[i - 1].Location.X + 80, lstBan[i - 1].Location.Y); } } i++; } temp += qlban.getAllTableforArea(k.MaKhuVuc).Count; tp.Refresh(); tabcrlBan.Controls.Add(tp); } }
private void LoadTabPage(TabPage tabPage) { if (tabPage != null && !tcMain.TabPages.Contains(tabPage)) { tcMain.TabPages.Clear(); tcMain.TabPages.Add(tabPage); // Need to set ImageKey again otherwise icon not show up tabPage.ImageKey = tabPage.ImageKey; tabPage.Refresh(); lvMain.Focus(); } }
/// <summary> /// Set text-box in tab page to update /// </summary> /// <param name="page"></param> /// <param name="control"></param> /// <returns></returns> public static TabPage Update(this TabPage page, TabControl control) { if (!page.Focused) { var host = (ElementHost)page.Controls[0]; var textBox = (MainTextBox)host.Child; textBox.Updated = true; } page.Refresh(); control.Refresh(); return(page); }
private void SukurtiGrupesPuslapi <T>(Grupe <T> grupe) where T : Studentas { TabPage puslapis = new TabPage(grupe.Pavadinimas); tabControl1.TabPages.Add(puslapis); FlowLayoutPanel skydelis = new FlowLayoutPanel(); skydelis.Dock = DockStyle.Fill; skydelis.FlowDirection = FlowDirection.TopDown; puslapis.Controls.Add(skydelis); Label kursas = new Label(); kursas.Text = "Kursas: " + grupe.Kursas; kursas.AutoSize = true; skydelis.Controls.Add(kursas); Label specializacija = new Label(); specializacija.Text = "Specializacija: " + grupe.Specializacija; specializacija.AutoSize = true; skydelis.Controls.Add(specializacija); Label kuratorius = new Label(); kuratorius.Text = "Kuratorius: " + grupe.Kuratorius; kuratorius.AutoSize = true; skydelis.Controls.Add(kuratorius); // Kuriame studentų lentelę: DataGridView tinklelis = new DataGridView(); tinklelis.AutoGenerateColumns = false; tinklelis.RowHeadersVisible = false; tinklelis.AllowUserToAddRows = false; tinklelis.AllowUserToDeleteRows = false; tinklelis.AutoSize = true; tinklelis.BackgroundColor = Color.White; BindingSource duomenuModelis = new BindingSource(); foreach (Studentas s in grupe.StudentuSarasas) { duomenuModelis.Add(s); } tinklelis.DataSource = duomenuModelis; DataGridViewColumn column = new DataGridViewTextBoxColumn(); column.DataPropertyName = "PazymejimoNr"; //nurodome Studento objekto sąvybės pavadinimą column.Name = "Paž. nr."; //nurodome stulpelio pavadinimą column.ReadOnly = true; tinklelis.Columns.Add(column); column = new DataGridViewTextBoxColumn(); column.DataPropertyName = "Vardas"; column.Name = "Vardas"; column.ReadOnly = true; tinklelis.Columns.Add(column); column = new DataGridViewTextBoxColumn(); column.DataPropertyName = "Pavarde"; column.Name = "Pavarde"; column.ReadOnly = true; tinklelis.Columns.Add(column); DataGridViewComboBoxColumn combo = new DataGridViewComboBoxColumn(); combo.DataSource = Enum.GetValues(typeof(Statusas)); combo.DataPropertyName = "Statusas"; combo.Name = "Statusas"; tinklelis.Columns.Add(combo); if (typeof(T) == typeof(Magistrantas)) { column = new DataGridViewTextBoxColumn(); column.DataPropertyName = "Tema"; column.Name = "Darbo tema"; column.ReadOnly = true; column.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; tinklelis.Columns.Add(column); } skydelis.Controls.Add(tinklelis); // Geriausio studento atvaizdavimas: Label geriausiasTitle = new Label(); geriausiasTitle.Text = "\nGeriausias studentas"; geriausiasTitle.AutoSize = true; skydelis.Controls.Add(geriausiasTitle); DataGridView geriausias = new DataGridView(); geriausias.AutoGenerateColumns = false; geriausias.RowHeadersVisible = false; geriausias.AllowUserToAddRows = false; geriausias.AllowUserToDeleteRows = false; geriausias.AutoSize = true; geriausias.BackgroundColor = Color.White; BindingSource geriausioDuomenuModelis = new BindingSource(); geriausioDuomenuModelis.Add(grupe.GeriausiasStudentas()); geriausias.DataSource = geriausioDuomenuModelis; DataGridViewColumn geriausiasColumn = new DataGridViewTextBoxColumn(); geriausiasColumn.DataPropertyName = "PazymejimoNr"; //nurodome Studento objekto sąvybės pavadinimą geriausiasColumn.Name = "Paž. nr."; //nurodome stulpelio pavadinimą geriausiasColumn.ReadOnly = true; geriausias.Columns.Add(geriausiasColumn); geriausiasColumn = new DataGridViewTextBoxColumn(); geriausiasColumn.DataPropertyName = "Vardas"; geriausiasColumn.Name = "Vardas"; geriausiasColumn.ReadOnly = true; geriausias.Columns.Add(geriausiasColumn); geriausiasColumn = new DataGridViewTextBoxColumn(); geriausiasColumn.DataPropertyName = "Pavarde"; geriausiasColumn.Name = "Pavarde"; geriausiasColumn.ReadOnly = true; geriausias.Columns.Add(geriausiasColumn); DataGridViewComboBoxColumn geriausiasCombo = new DataGridViewComboBoxColumn(); geriausiasCombo.DataSource = Enum.GetValues(typeof(Statusas)); geriausiasCombo.DataPropertyName = "Statusas"; geriausiasCombo.Name = "Statusas"; geriausias.Columns.Add(geriausiasCombo); if (typeof(T) == typeof(Magistrantas)) { geriausiasColumn = new DataGridViewTextBoxColumn(); geriausiasColumn.DataPropertyName = "Tema"; geriausiasColumn.Name = "Darbo tema"; geriausiasColumn.ReadOnly = true; geriausiasColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; geriausias.Columns.Add(geriausiasColumn); } skydelis.Controls.Add(geriausias); puslapis.Refresh(); }
void taoKhuVuc() { foreach (KhuVuc k in qlban.getAllKhuVuc()) { TabPage tp = new TabPage(k.MaKhuVuc); lstTabPage.Add(tp); tp.Width = this.Width / 2; tp.Text = k.MaKhuVuc; tp.BackColor = Color.Aqua; //qlban.getAllTableforArea(k.MaKhuVuc); foreach (Ban b in qlban.getAllTableforArea(k.MaKhuVuc)) { SimpleButton ban = new SimpleButton(); ban.Click += frmQuanLyKhu_Click; lstBan.Add(ban); lstBan[i].Size = new Size(50, 50); lstBan[i].BackColor = Color.Aqua; lstBan[i].Name = b.MaBan.ToString().Trim(); //lstBan[i].Text = b.TenBan.ToString(); lstBan[i].Text += Environment.NewLine + b.TenBan.ToString(); lstBan[i].ImageOptions.Location = ImageLocation.TopCenter; lstBan[i].AppearancePressed.BackColor = Color.Red; lstBan[i].AppearanceHovered.BackColor = Color.Pink; tp.Controls.Add(lstBan[i]); if (b.TrangThai == 0) { lstBan[i].ImageOptions.Image = global::AppQuanLyBanCafe.Properties.Resources.chuaco; lstBan[i].AutoSize = true; this.lstBan[i].ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; this.lstBan[i].Appearance.Options.UseBackColor = true; lstBan[i].BackgroundImageLayout = ImageLayout.Stretch; } else if (b.TrangThai == 2) { lstBan[i].ImageOptions.Image = global::AppQuanLyBanCafe.Properties.Resources.datban; lstBan[i].AutoSize = true; this.lstBan[i].ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; this.lstBan[i].Appearance.Options.UseBackColor = true; } else { lstBan[i].ImageOptions.Image = global::AppQuanLyBanCafe.Properties.Resources.daco; lstBan[i].AutoSize = true; this.lstBan[i].ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder; this.lstBan[i].Appearance.Options.UseBackColor = true; lstBan[i].Appearance.BackColor = Color.Transparent; } if (i == temp) { lstBan[i].Location = new Point(30, 5); } else { if (lstBan[i - 1].Location.X + 150 > tp.Width) { lstBan[i].Location = new Point(30, lstBan[i - 1].Location.Y + 80); } else { lstBan[i].Location = new Point(lstBan[i - 1].Location.X + 80, lstBan[i - 1].Location.Y); } } i++; } temp += qlban.getAllTableforArea(k.MaKhuVuc).Count; tp.Refresh(); tabControl.Controls.Add(tp); } }
private void AddParameterToPage(TabPage page, ParameterVm paramVm, TabControl tbc, string pageTitle, string pageName) { var lt = new List <IMpUserControlParam>(); var sumH = 0; var maxW = 500; var maxLabelW = 100; var i = 1; foreach (ParameterItemVm paramItem in paramVm.items.Where(s => s.status == EnumStatus.A.ToString()).OrderBy(s => s.ordered)) { IParamItemApi objParamItem = new ParamItemApi(ObjParam.GetWsObj, ObjParam.GetMsgObj, ObjParam.GetFlexObj, paramItem) { RouteDetail = ObjParam.RouteDetail }; IMpUserControlParam ucParamItem; if (paramItem.input_type == EnumParamItemType.LIST.ToString()) { ucParamItem = new UcParamItemList(objParamItem, ObjControlBuilder); } else if (paramItem.input_type == EnumParamItemType.RADIO.ToString()) { ucParamItem = new UcParamItemRadio(objParamItem, ObjControlBuilder); } else if (paramItem.input_type == EnumParamItemType.OPTION.ToString()) { ucParamItem = new UcParamItemOption(objParamItem, ObjControlBuilder); } else { ucParamItem = new UcParamItemTextBox(objParamItem, ObjControlBuilder); } ucParamItem.SetTabIndex(i); ucParamItem.ShowData(); sumH = sumH + ucParamItem.ControlHeight; if (ucParamItem.ControlWidth > maxW) { maxW = ucParamItem.ControlWidth; } if (ucParamItem.LabelParamNameWidth > maxLabelW) { maxLabelW = ucParamItem.LabelParamNameWidth; } lt.Add(ucParamItem); i = i + 1; } var ltControl = new List <UserControl>(); foreach (var obj in lt) { obj.LabelWidth(maxLabelW); ltControl.Add((UserControl)obj); } if (tbc.Size.Height <= sumH) { tbc.Size = new Size(maxW, sumH + 50); } if (page.Size.Height <= sumH) { page.Size = new Size(maxW, sumH + 50); } page.Refresh(); ObjControlBuilder.RenderTabForm(ltControl, pageName, pageTitle, tbc, false); }
public void ReadClassifierTable() { for (int i = com.DictionaryAttributes() + com.DictionaryClasses(); i < com.DictionaryElements(); i++) { classifier.Add(com.GetNumber(i)); } List <DSClassifierWrapper> classifiers = hierarchy_.getClassifiers(); foreach (string cl in classifier) { DataTable dt22 = new DataTable(); DataColumn column; DataRow row; DSClassifierWrapper classifier_ = classifiers[classifier.IndexOf(cl)]; dt22.TableName = "dat" + classifier.IndexOf(cl); column = new DataColumn(); column.ColumnName = "Класс"; dt22.Columns.Add(column); column = new DataColumn(); column.ColumnName = "Степень принадлежности"; dt22.Columns.Add(column); tabpage1 = new TabPage(); tabpage1.SuspendLayout(); tabpage1.Name = cl; tabControl1.TabPages.Add(tabpage1); tabControl1.SelectedTab = tabpage1; tabpage1.Text = cl.ToString(); DGV = new DataGridView(); DGV.Name = "DataGridV" + classifier.IndexOf(cl); DGV.BackgroundColor = Color.White; DGV.Parent = tabpage1; DGV.Location = new Point(7, 7); DGV.Size = new Size(299, 162); DGV.BorderStyle = BorderStyle.FixedSingle; DGV.Visible = true; DGV.AllowUserToAddRows = false; DGV.ReadOnly = true; foreach (DSClassWrapper cls in classifier_.getClasses()) { foreach (DataRow dr in dtClasses.Rows) { if ((cls.getID() + " " + cls.getName()) == dr["Класс"].ToString()) { row = dt22.NewRow(); row["Класс"] = dr["Класс"]; dt22.Rows.Add(row); } } } DGV.DataSource = dt22; datatable.Add(dt22); tabControl1.TabPages[cl].Controls.Add(DGV); tabpage1.ResumeLayout(); tabpage1.Refresh(); } }