public void Init(string NoiDung, List <DapAn> listDapAn) { txtCauHoi.Text = NoiDung; SoDapAn = listDapAn.Count; //Đáp án for (int i = listDapAn.Count - 1; i >= 0; i--) { //Nội dung chỗ trống RichTextBox richTextBox = new RichTextBox(); richTextBox.ContextMenuStrip = MenuCon; richTextBox.Dock = DockStyle.Top; richTextBox.Size = new Size(548, 40); richTextBox.Text = listDapAn[i].NoiDungDapAn; richTextBox.Name = "richDapAn"; //Groupbox Đáp án GroupBox groupBox = new GroupBox(); groupBox.Controls.Add(richTextBox); groupBox.Dock = DockStyle.Top; groupBox.Location = new Point(0, 0); groupBox.TabStop = false; groupBox.Text = listDapAn[i].TenDapAn; groupBox.AutoSize = true; groupBox.Name = "groupDapAn"; panelChoTrong.Controls.Add(groupBox); groupBox.BringToFront(); } }
private void listShapes_SelectedIndexChanged(object sender, EventArgs e) { //show or hide the correct groupbox //set to the blank box GroupBox selected = grpDefault; switch (listShapes.SelectedItem) { case "Circle": selected = grpCircle; break; case "Rectangle": selected = grpRectangle; break; default: //no shape selected, show the blank parameters box break; } //move the selected groupbox to it's positon selected.Location = new Point(10, 125); selected.BringToFront(); }
private void btnThemChoTrong_Click(object sender, EventArgs e) { SoDapAn++; txtCauHoi.Text += " ... "; //Nội dung chỗ trống RichTextBox richTextBox = new RichTextBox(); richTextBox.ContextMenuStrip = MenuCon; richTextBox.Dock = DockStyle.Top; richTextBox.Size = new Size(548, 40); richTextBox.Text = ""; richTextBox.Name = "richDapAn"; //Groupbox Đáp án GroupBox groupBox = new GroupBox(); groupBox.Controls.Add(richTextBox); groupBox.Dock = DockStyle.Top; groupBox.Location = new Point(0, 0); groupBox.TabStop = false; groupBox.Text = "Chỗ trống " + SoDapAn; groupBox.AutoSize = true; groupBox.Name = "groupDapAn"; panelChoTrong.Controls.Add(groupBox); groupBox.BringToFront(); panelChoTrong.ScrollControlIntoView(btnThemChoTrong); }
public static void CentraliseGroupBox(GroupBox gd) { gd.Left = (Screen.PrimaryScreen.WorkingArea.Width - gd.Width) / 2; gd.Top = (Screen.PrimaryScreen.WorkingArea.Height - gd.Height) / 2; gd.Visible = true; gd.BringToFront(); }
/// <summary> /// Sobrecarga del constructor por defecto para poder instanciar dos /// formularios distintos segun la cantidad de parametros. /// frmCarrito o frmBusqueda /// </summary> /// <param name="tituloFrm"></param> public FrmCarrito(string tituloFrm) : this() { if (tituloFrm == "Busqueda") { GroupBox groupBoxBuscar; Button btnBuscar; btnBuscar = new Button(); btnBuscar.Size = new Size(117, 38); btnBuscar.Location = new Point(119, 29); btnBuscar.Click += new EventHandler(btnBuscar_Click); groupBoxBuscar = new GroupBox(); groupBoxBuscar.Location = new Point(23, 210); groupBoxBuscar.Size = new Size(367, 100); groupBoxBuscar.Controls.Add(btnBuscar); this.Controls.Add(groupBoxBuscar); this.Controls.Add(groupBoxBuscar); this.groupBoxCompra.Enabled = false; this.groupBoxCompra.Visible = false; groupBoxBuscar.BringToFront(); groupBoxBuscar.Text = "Buscar"; btnBuscar.Text = "Busqueda"; this.groupBoxCarrito.Text = tituloFrm; //this.groupBoxListarPedidos.Visible = false; this.groupBoxListarPedidos.Text = "Producto y Manual"; this.ListarProductosInventario(); this.comboBoxTipoAmbito.DataSource = Enum.GetValues(typeof(TipoAmbito)); this.comboBoxTipoUsuario.DataSource = Enum.GetValues(typeof(TipoUsuario)); } else { this.BackColor = Color.Pink; this.groupBoxCompra.Visible = true; //this.groupBoxBuscar.Visible = false; this.groupBoxCarrito.Text = tituloFrm; this.groupBoxListarPedidos.Visible = true; this.Width = 1107; if (VerificaCarritoNoVacio(Tienda.Pedido)) { this.btnComprar.Enabled = true; } else { this.btnComprar.Enabled = false; } this.ListarProductosInventario(); this.comboBoxTipoAmbito.DataSource = Enum.GetValues(typeof(TipoAmbito)); this.comboBoxTipoUsuario.DataSource = Enum.GetValues(typeof(TipoUsuario)); } }
public void Update(Control child, Control parent) { parent.Hide(); GroupBox box = new GroupBox(); box.Parent = parent; box.Location = parent.Location; box.Text = "sdfjsdfbskhdbfj<dbfj<bdfj<bdjfb<sjdbf<jsd fj <bvsdjfb<jsdfus"; box.BringToFront(); }
//Khi xóa chỗ trống trên richtextbox thì groupbox sẽ xóa theo private void txtCauHoi_TextChanged(object sender, EventArgs e) { int DemSoChoTrong = 0; string[] ChoTrong = txtCauHoi.Text.Trim().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); foreach (string temp in ChoTrong) { if (temp.Contains("...")) { DemSoChoTrong++; } } if (DemSoChoTrong < SoDapAn) { int temp = SoDapAn - DemSoChoTrong; SoDapAn -= temp; for (int i = 0; i < temp; i++) { panelChoTrong.Controls.Remove(panelChoTrong.Controls[0]); } } else if (DemSoChoTrong > SoDapAn) { int temp = DemSoChoTrong - SoDapAn; SoDapAn += temp; for (int i = 0; i < temp; i++) { RichTextBox richTextBox = new RichTextBox(); richTextBox.ContextMenuStrip = this.MenuCon; richTextBox.Dock = System.Windows.Forms.DockStyle.Top; richTextBox.Size = new System.Drawing.Size(548, 40); richTextBox.Text = ""; GroupBox groupBox = new GroupBox(); groupBox.Controls.Add(richTextBox); groupBox.Dock = System.Windows.Forms.DockStyle.Top; groupBox.Location = new System.Drawing.Point(0, 0); groupBox.TabStop = false; groupBox.Text = "Chỗ trống " + SoDapAn; groupBox.AutoSize = true; panelChoTrong.Controls.Add(groupBox); groupBox.BringToFront(); } panelChoTrong.ScrollControlIntoView(btnThemChoTrong); } }
private void bt_for_Click(object sender, EventArgs e) { int x = 0, y = 0; redo: foreach (Control control in this.Controls) { if (control.GetType().Name == "GroupBox") { if (control.Location.X == x && control.Location.Y == y) { x += 15; y += 15; goto redo; } } } GroupBox g = new GroupBox(); TextBox t1 = new TextBox(); TextBox t2 = new TextBox(); TextBox t3 = new TextBox(); g.BackColor = Color.FromArgb(120, 40, 40, 40); //創GroupBox this.Controls.Add(g); g.Location = new System.Drawing.Point(x, y); g.Size = new System.Drawing.Size(160, 50); g.Text = "For"; //t1 g.Controls.Add(t1); t1.Location = new System.Drawing.Point(15, 15); t1.Size = new System.Drawing.Size(40, 20); //t2 g.Controls.Add(t2); t2.Location = new System.Drawing.Point(60, 15); t2.Size = new System.Drawing.Size(40, 20); //t3 g.Controls.Add(t3); t3.Location = new System.Drawing.Point(105, 15); t3.Size = new System.Drawing.Size(40, 20); //右鍵功能表 g.ContextMenuStrip = this.contextMenuStrip1; g.MouseMove += ctrl_MouseMove; g.MouseDown += ctrl_MouseDown; g.BringToFront(); }
private void bt_dim_Click(object sender, EventArgs e) { int x = 0, y = 0; redo: foreach (Control control in this.Controls) { if (control.GetType().Name == "GroupBox") { if (control.Location.X == x && control.Location.Y == y) { x += 15; y += 15; goto redo; } } } GroupBox g = new GroupBox(); TextBox t1 = new TextBox(); ComboBox c1 = new ComboBox(); g.BackColor = Color.LightGray; //創GroupBox this.Controls.Add(g); g.Location = new System.Drawing.Point(x, y); g.Size = new System.Drawing.Size(130, 50); g.Text = "Dim"; //t1 g.Controls.Add(t1); t1.Location = new System.Drawing.Point(15, 15); t1.Size = new System.Drawing.Size(40, 20); //c1 g.Controls.Add(c1); c1.Items.AddRange(new object[] { "int", "float", "char", "string" }); c1.Location = new System.Drawing.Point(65, 15); c1.Size = new System.Drawing.Size(60, 20); //右鍵功能表 g.ContextMenuStrip = this.contextMenuStrip1; g.MouseMove += ctrl_MouseMove; g.MouseDown += ctrl_MouseDown; g.BringToFront(); }
/// <summary> /// Sets up general boxes for UI. /// </summary> private void CreateGroupBoxes() { var mapBox = CreateGroupBox(_mainForm, .75, .95, _control, _control, .01, .025, Color.Black); _mapGroupBox = mapBox; _mapGroupBox.Font = new Font("serif", 1000); _mapGroupBox.BringToFront(); var reportBox = CreateGroupBox(_mainForm, .2, .45, _mapGroupBox, _control, .025, .025, Color.Gray); _reportGroupBox = reportBox; _reportGroupBox.Text = "Report"; _reportGroupBox.BringToFront(); var controlBox = CreateGroupBox(_mainForm, .2, .45, _mapGroupBox, _reportGroupBox, .025, .025, Color.Gray); _controlBox = controlBox; _controlBox.Text = "Controls"; _controlBox.BringToFront(); }
public void btnThemDapAn_Click(object sender, EventArgs e) { //Nút đúng sai SwitchButton switchButton = new SwitchButton(); switchButton.BackgroundStyle.CornerType = eCornerType.Square; switchButton.Dock = DockStyle.Top; switchButton.Location = new Point(3, 16); switchButton.OffText = "Đáp án sai"; switchButton.OnText = "Đáp án đúng"; switchButton.Size = new Size(548, 22); switchButton.Style = eDotNetBarStyle.StyleManagerControlled; switchButton.Name = "switchDapAn"; //Nội dung đáp án RichTextBox richTextBox = new RichTextBox(); richTextBox.ContextMenuStrip = MenuCon; richTextBox.Dock = DockStyle.Top; richTextBox.Size = new Size(548, 40); richTextBox.Text = ""; richTextBox.Name = "richDapAn"; //Groupbox đáp án GroupBox groupBox = new GroupBox(); groupBox.Controls.Add(richTextBox); groupBox.Controls.Add(switchButton); groupBox.Dock = DockStyle.Top; groupBox.Location = new Point(0, 0); groupBox.TabStop = false; groupBox.Text = strThuTu[panelListDapAn.Controls.Count - 1]; groupBox.AutoSize = true; groupBox.Name = "groupDapAn"; panelListDapAn.Controls.Add(groupBox); groupBox.BringToFront(); panelListDapAn.ScrollControlIntoView(btnThemDapAn); }
/// <summary> /// 加载机台缸 /// </summary> private void LoadDevicePot() { DS_PotDAL potDAL = new DS_PotDAL(); List <View_DeviceInfoModel> potList = potDAL.GetPotListByType(3);//获取所有缸信息 int groupBoxWidth = panelAlarm.Width / potList.Count; foreach (View_DeviceInfoModel potModel in potList) { CabinetListen cabinetListen = new CabinetListen(potModel.PotCode, potModel.Id.ToString()); GroupBox gb = cabinetListen.GetCabientInfo(panelAlarm.Width, DockStyle.Left, potModel.PotCode, potModel.PotName); gb.Width = groupBoxWidth + 1; gb.Text = Environment.NewLine + potModel.PotName; gb.ForeColor = Color.White; gb.Font = new System.Drawing.Font("宋体", 12, FontStyle.Regular); gb.Padding = new System.Windows.Forms.Padding(5, 20, 5, 5); gb.Tag = potModel.PotCode; panelAlarm.Controls.Add(gb); gb.BringToFront(); } }
public void Init(string NoiDung, List <DapAn> listDapAn) { txtCauHoi.Text = NoiDung; //Đáp án for (int i = listDapAn.Count - 1; i >= 0; i--) { RichTextBox richTextBox = new RichTextBox(); richTextBox.ContextMenuStrip = this.MenuCon; richTextBox.Dock = DockStyle.Top; richTextBox.Size = new Size(548, 40); richTextBox.Text = listDapAn[i].NoiDungDapAn; richTextBox.Name = "richDapAn"; SwitchButton switchButton = new SwitchButton(); switchButton.BackgroundStyle.CornerType = eCornerType.Square; switchButton.Dock = DockStyle.Top; switchButton.Location = new Point(3, 16); switchButton.OffText = "Đáp án sai"; switchButton.OnText = "Đáp án đúng"; switchButton.Size = new Size(548, 22); switchButton.Style = eDotNetBarStyle.StyleManagerControlled; switchButton.Name = "switchDapAn"; switchButton.Value = Convert.ToBoolean(listDapAn[i].DapAnDung); GroupBox groupBox = new GroupBox(); groupBox.Controls.Add(richTextBox); groupBox.Controls.Add(switchButton); groupBox.Dock = DockStyle.Top; groupBox.Location = new Point(0, 0); groupBox.TabStop = false; groupBox.Text = listDapAn[i].TenDapAn; groupBox.AutoSize = true; groupBox.Name = "groupDapAn"; panelListDapAn.Controls.Add(groupBox); groupBox.BringToFront(); } }
void syntaxTree_AfterSelect(object sender, TreeViewEventArgs e) { if (group != null) { group.Visible = false; } if (e.Node.Tag is STNode) { var node = (STNode)e.Node.Tag; txtInput.SelectionStart = node.Start; txtInput.SelectionLength = node.Length; isUpdatingUI = true; switch (node.Type) { case STNodeType.RANGE: { group = groupRange; txtRangeAddress.Text = ((STRangeNode)node).Range.ToAddress(); } break; case STNodeType.CELL: { group = groupCell; txtCellAddress.Text = ((STCellNode)node).Position.ToAddress(); } break; case STNodeType.FUNCTION_CALL: { var funNode = (STFunctionNode)node; group = groupFunCall; txtFunName.Text = funNode.Name; lstArgs.Items.Clear(); for (int i = 1; i < node.Children.Count; i++) { lstArgs.Items.Add(node.Children[i].ToString()); } } break; case STNodeType.IDENTIFIER: { group = groupName; txtName.Text = ((STIdentifierNode)node).Identifier; } break; case STNodeType.CONNECT: { group = groupConnect; txtConnectLeft.Text = node.Children[0].ToString(); txtConnectRight.Text = node.Children[1].ToString(); } break; default: group = null; break; } isUpdatingUI = false; if (group != null) { group.Dock = DockStyle.Fill; group.Visible = true; group.BringToFront(); } } }
public OtsuSegmentation(Panel mainPanel, ImageAnalyser IA) { this.IA = IA; //Core panel panel.Dock = DockStyle.Top; panel.BackColor = IA.FileBrowser.BackGround2Color1; panel.ForeColor = IA.FileBrowser.ShriftColor1; panel.Visible = false; panel.Height = 150; mainPanel.Controls.Add(panel); panel.BringToFront(); #region Options GroupBox optionGB = new GroupBox(); optionGB.Text = "Options:"; optionGB.BackColor = IA.FileBrowser.BackGround2Color1; optionGB.ForeColor = IA.FileBrowser.ShriftColor1; optionGB.Dock = DockStyle.Top; optionGB.Height = 85; panel.Controls.Add(optionGB); optionGB.BringToFront(); Label Name = new Label(); Name.Text = "Thresholds:"; Name.Width = TextRenderer.MeasureText(Name.Text, Name.Font).Width; Name.Location = new Point(5, 18); optionGB.Controls.Add(Name); Name.BringToFront(); ComboBox cb = thresholdsNumCB; cb.Text = "0"; cb.Items.AddRange(new string[] { "0", "1", "2", "3", "4" }); cb.Width = 40; cb.Location = new Point(80, 15); optionGB.Controls.Add(cb); cb.BringToFront(); cb.DropDownStyle = ComboBoxStyle.DropDownList; cb.SelectedIndex = 0; cb.AutoSize = false; cb.SelectedIndexChanged += new EventHandler(delegate(object o, EventArgs e) { TifFileInfo fi = IA.TabPages.TabCollections[IA.TabPages.SelectedIndex].tifFI; fi.thresholdsCBoxIndex[fi.cValue] = cb.SelectedIndex; IA.ReloadImages(); }); CheckBox checkB = sumHistogramsCheckBox; checkB.Text = "Use SUM histogram"; checkB.Tag = "Use SUM histogram:\nCalculates histograms for all images\nand merge them into one"; checkB.Width = 150; checkB.Checked = true; checkB.MouseHover += Control_MouseOver; checkB.Location = new Point(7, 35); optionGB.Controls.Add(checkB); checkB.BringToFront(); checkB.CheckedChanged += new EventHandler(delegate(object o, EventArgs e) { TifFileInfo fi = IA.TabPages.TabCollections[IA.TabPages.SelectedIndex].tifFI; fi.sumHistogramChecked[fi.cValue] = checkB.Checked; if (((CheckBox)o).Focused == true) { IA.ReloadImages(); } }); { Button btn = ProcessBtn; btn.Width = 115; btn.FlatStyle = FlatStyle.Standard; btn.BackColor = SystemColors.ButtonFace; btn.ForeColor = Color.Black; btn.Text = "Process"; btn.Location = new Point(5, 58); optionGB.Controls.Add(btn); btn.BringToFront(); btn.Click += new EventHandler(delegate(object o, EventArgs a) { int MLEVEL = thresholdsNumCB.SelectedIndex + 1; if (IA.Segmentation.SegmentationCBox.SelectedIndex == 2) { IA.Segmentation.Kmeans.Start(MLEVEL); return; } if (IA.Segmentation.SegmentationCBox.SelectedIndex != 1) { return; } TifFileInfo fi = IA.TabPages.TabCollections[IA.TabPages.SelectedIndex].tifFI; if (fi.available == false) { MessageBox.Show("Image is not ready yet! \nTry again later."); } else { //background worker var bgw = new BackgroundWorker(); bgw.WorkerReportsProgress = true; bgw.DoWork += new DoWorkEventHandler(delegate(Object o1, DoWorkEventArgs a1) { try { //Segmentation event run(fi, MLEVEL); } catch { } //report progress ((BackgroundWorker)o1).ReportProgress(0); }); bgw.ProgressChanged += new ProgressChangedEventHandler(delegate(Object o1, ProgressChangedEventArgs a1) { fi.available = true; IA.FileBrowser.StatusLabel.Text = "Ready"; IA.MarkAsNotSaved(); IA.ReloadImages(); }); //Apply status IA.FileBrowser.StatusLabel.Text = "Segmentation..."; fi.available = false; //start bgw bgw.RunWorkerAsync(); } }); } #endregion Options #region Thresholds GroupBox threshGB = new GroupBox(); threshGB.Text = "Thresholds:"; threshGB.BackColor = IA.FileBrowser.BackGround2Color1; threshGB.ForeColor = IA.FileBrowser.ShriftColor1; threshGB.Dock = DockStyle.Fill; threshGB.Height = 50; panel.Controls.Add(threshGB); threshGB.BringToFront(); //Color btns Panel colorPanel = new Panel(); colorPanel.Dock = DockStyle.Left; colorPanel.Width = 25; threshGB.Controls.Add(colorPanel); Panel UpPanel = new Panel(); UpPanel.Dock = DockStyle.Top; UpPanel.Height = 15; threshGB.Controls.Add(UpPanel); UpPanel.BringToFront(); for (int i = 0; i < colorBtns.Length; i++) { Button btn = new Button(); btn.FlatStyle = FlatStyle.Flat; btn.FlatAppearance.BorderSize = 0; btn.ForeColor = Color.Black; btn.Text = ""; btn.Tag = i; btn.Dock = DockStyle.Top; btn.Height = 25; colorPanel.Controls.Add(btn); colorBtns[i] = btn; btn.BringToFront(); btn.Visible = false; btn.MouseDown += new MouseEventHandler(ColorBtn_Click); btn.MouseHover += new EventHandler(delegate(object o, EventArgs a) { if (btn.Text == "") { TurnOnToolTip.SetToolTip(btn, "Color " + ((int)btn.Tag).ToString() + ":\nLeft click to Disable\nRight click to change color"); } else { TurnOnToolTip.SetToolTip(btn, "Color " + ((int)btn.Tag).ToString() + " - Disabled\nLeft click to Enable"); } }); } //threshold track bars for (int i = 0; i < threshTrackBars.Length; i++) { CTTrackBar tb = new CTTrackBar(); tb.Initialize(); tb.Panel.Dock = DockStyle.Top; tb.BackColor(IA.FileBrowser.BackGround2Color1); tb.ForeColor(IA.FileBrowser.ShriftColor1); tb.Panel.Visible = false; tb.Refresh(0, 0, 10); tb.Name.Text = "T" + (i + 1).ToString(); tb.NamePanel.Width = 30; threshGB.Controls.Add(tb.Panel); threshTrackBars[i] = tb; tb.Panel.BringToFront(); tb.Value.Changed += new ChangedValueEventHandler(delegate(Object o, ChangeValueEventArgs a) { TrackBar_ValueChange(a, tb); }); } #endregion Thresholds }
private void button3_Click(object sender, EventArgs e) { //show popup for new author adding if (!Controls.ContainsKey("newAuthor")) { GroupBox box = new GroupBox() { Size = new Size(150, 100), Location = new Point(Width / 2 - 75, Height / 2 - 50), Parent = this, Name = "newAuthor", Text = "Add new author" }; TextBox txt = new TextBox() { Location = new Point(10, 30), Width = 130 }; box.Controls.Add(txt); Button btn = new Button() { Text = "Add", Width = 60, Height = 35, Location = new Point(5, 60), }; btn.Click += (s, ev) => { if (txt.Text == "") { MessageBox.Show("Author can not be empty!"); } else if (tmp.Contains(txt.Text)) { MessageBox.Show("Already added!"); } else { Worker work = new Worker(); long id = work.AddAuthor(txt.Text); tmp.Add(txt.Text); dataGridView1.AllowUserToAddRows = true; dataGridView1.Rows.Add(); dataGridView1["id", dataGridView1.Rows.Count - 2].Value = id; dataGridView1["name", dataGridView1.Rows.Count - 2].Value = txt.Text; dataGridView1.AllowUserToAddRows = false; FillAuthorSource(); Controls.RemoveByKey("newAuthor"); } }; box.Controls.Add(btn); Button btn1 = new Button() { Text = "Close", Width = 60, Height = 35, Location = new Point(85, 60), }; btn1.Click += (s, ev) => { Controls.RemoveByKey("newAuthor"); }; box.Controls.Add(btn1); box.BringToFront(); } }
public void GenerateAll() { Panel panels = new Panel(); panels.Name = "MainPanel"; panels.Size = new System.Drawing.Size(865, 756); panels.Dock = System.Windows.Forms.DockStyle.Fill; panels.TabIndex = 0; panels.AutoScroll = true; int Locationx = 10; int Locationy = 10; string query = "SELECT * FROM tblcontestant;"; DataTable dts = dbutil.SelectTable(query); foreach (DataRow rs in dts.Rows) { int i = 1; GroupBox gb = new GroupBox(); PictureBox pb = new PictureBox(); Label lbname = new Label(); Label lbinfo = new Label(); Button btn = new Button(); if (Locationx == 10) { gb.Name = "GroupBox" + a; gb.Location = new Point(Locationx, Locationy); gb.Size = new Size(406, 348); gb.Font = new Font("Segoe UI", 15); gb.FlatStyle = FlatStyle.Standard; gb.BringToFront(); gb.Visible = true; gb.Text = "Contestant" + rs["ID"].ToString(); string path = rs["ImagePath"].ToString(); path.Replace("\\", "\\\\"); pb.Name = "PictureBox" + i; pb.Location = new Point(93, 30); pb.Size = new System.Drawing.Size(220, 225); pb.SizeMode = PictureBoxSizeMode.StretchImage; pb.Image = hm.GetCopyImage(path); gb.Controls.Add(pb); string change = rs["Name"].ToString(); int yy = 258; for (int x = 0; x < 2; x++) { lbname = new Label(); lbname.Name = "LabelName" + i; lbname.Text = change; lbname.Location = new System.Drawing.Point(128, yy); lbname.AutoSize = true; lbname.Font = new Font("Segoe UI", 12); gb.Controls.Add(lbname); change = rs["Information"].ToString(); yy += 20; } //button btn.Name = "btnScore" + i; btn.Text = "SCORE"; btn.Location = new System.Drawing.Point(150, 302); btn.Font = new Font("Segoe UI", 12); btn.AutoSize = true; btn.Click += new System.EventHandler(btn_Click); gb.Controls.Add(btn); panels.Controls.Add(gb); a += 1; Locationx = 420; } else if (Locationx != 10) { gb.Name = "GroupBox" + a; gb.Location = new Point(Locationx, Locationy); gb.Size = new Size(406, 348); gb.Font = new Font("Segoe UI", 15); gb.FlatStyle = FlatStyle.Standard; gb.Visible = true; gb.BringToFront(); gb.Text = "Contestant " + rs["ID"].ToString(); string path = rs["ImagePath"].ToString(); path.Replace("\\", "\\\\"); pb.Name = "PictureBox" + i; pb.Location = new Point(93, 30); pb.Size = new System.Drawing.Size(220, 225); pb.SizeMode = PictureBoxSizeMode.StretchImage; pb.Image = hm.GetCopyImage(path); gb.Controls.Add(pb); string change = rs["Name"].ToString(); int yy = 258; for (int x = 0; x < 2; x++) { lbname = new Label(); lbname.Name = "LabelName" + i; lbname.Text = change; lbname.Location = new System.Drawing.Point(128, yy); lbname.AutoSize = true; lbname.Font = new Font("Segoe UI", 12); gb.Controls.Add(lbname); change = rs["Information"].ToString(); yy += 20; } btn.Name = "btnScore" + i; btn.Text = "SCORE"; btn.Location = new System.Drawing.Point(150, 302); btn.Font = new Font("Segoe UI", 12); btn.AutoSize = true; btn.Click += new System.EventHandler(btn_Click); gb.Controls.Add(btn); panels.Controls.Add(gb); a += 1; Locationx = 10; Locationy += 350; } i++; } Button btnSubmit = new Button(); btnSubmit.Name = "btnSubmit"; btnSubmit.Text = "SUBMIT"; btnSubmit.Location = new System.Drawing.Point(750, Locationy); btnSubmit.Font = new Font("Segoe UI", 12); btnSubmit.AutoSize = true; panels.Controls.Add(btnSubmit); this.Controls.Add(panels); }
public void ShowHideMD(Form frm, string GrpName) { // Complication Control grp = SubRoutine.FindControl(frm, "GrpComp"); GroupBox ctlGrp = grp as GroupBox; if (GrpName == "GrpComp") { ctlGrp.BringToFront(); } else { ctlGrp.SendToBack(); } // CPT grp = SubRoutine.FindControl(frm, "GrpCpt"); ctlGrp = grp as GroupBox; if (GrpName == "GrpCpt") { ctlGrp.BringToFront(); } else { ctlGrp.SendToBack(); } // Image Descriptors grp = SubRoutine.FindControl(frm, "GrpImageDesc"); ctlGrp = grp as GroupBox; if (GrpName == "GrpImageDesc") { ctlGrp.BringToFront(); } else { ctlGrp.SendToBack(); } // DX grp = SubRoutine.FindControl(frm, "GrpDx"); ctlGrp = grp as GroupBox; if (GrpName == "GrpDx") { ctlGrp.BringToFront(); } else { ctlGrp.SendToBack(); } // Dr grp = SubRoutine.FindControl(frm, "GrpDr"); ctlGrp = grp as GroupBox; if (GrpName == "GrpDr") { ctlGrp.BringToFront(); } else { ctlGrp.SendToBack(); } // Fiscal Year grp = SubRoutine.FindControl(frm, "GrpFiscalYr"); ctlGrp = grp as GroupBox; if (GrpName == "GrpFiscalYr") { ctlGrp.BringToFront(); } else { ctlGrp.SendToBack(); } // Hospital grp = SubRoutine.FindControl(frm, "GrpHospital"); ctlGrp = grp as GroupBox; if (GrpName == "GrpHospital") { ctlGrp.BringToFront(); } else { ctlGrp.SendToBack(); } // Instrumentation grp = SubRoutine.FindControl(frm, "GrpInst"); ctlGrp = grp as GroupBox; if (GrpName == "GrpInst") { ctlGrp.BringToFront(); } else { ctlGrp.SendToBack(); } // Level grp = SubRoutine.FindControl(frm, "GrpLevel"); ctlGrp = grp as GroupBox; if (GrpName == "GrpLevel") { ctlGrp.BringToFront(); } else { ctlGrp.SendToBack(); } // Location grp = SubRoutine.FindControl(frm, "GrpLocation"); ctlGrp = grp as GroupBox; if (GrpName == "GrpLocation") { ctlGrp.BringToFront(); } else { ctlGrp.SendToBack(); } // Surgery grp = SubRoutine.FindControl(frm, "GrpSurgery"); ctlGrp = grp as GroupBox; if (GrpName == "GrpSurgery") { ctlGrp.BringToFront(); } else { ctlGrp.SendToBack(); } }
private void BuildControls() { this.Controls.Clear(); this.GroupBoxes.Clear(); this.CheckBoxes.Clear(); this.SuspendLayout(); foreach (Buff buff in Buff.RelevantBuffs) { if (!GroupBoxes.ContainsKey(buff.Group)) { GroupBox groupBox = new GroupBox(); groupBox.Text = buff.Group; groupBox.Tag = buff.Group; groupBox.Font = new Font(this.Font.FontFamily, 7f); groupBox.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right; groupBox.MouseMove += new MouseEventHandler(BuffSelector_MouseMove); groupBox.Dock = DockStyle.Top; GroupBoxes.Add(buff.Group, groupBox); this.Controls.Add(groupBox); groupBox.BringToFront(); } } List <Buff> buffs = Buff.RelevantBuffs; foreach (Buff buff in buffs) { if (Character == null || !Rawr.Properties.GeneralSettings.Default.HideProfEnchants || (buff.Professions != null && Character.HasProfession(buff.Professions))) { ExtendedToolTipCheckBox checkBox = new ExtendedToolTipCheckBox(); checkBox.Tag = buff; if (Rawr.Properties.GeneralSettings.Default.DisplayBuffSource && buff.Source != null) { checkBox.Text = buff.Name + " (" + buff.Source + ")"; } else { checkBox.Text = buff.Name; } checkBox.AutoSize = true; checkBox.Font = this.Font; checkBox.Dock = DockStyle.Top; checkBox.ToolTipText = buff.Stats.ToString(); checkBox.CheckedChanged += new EventHandler(checkBoxBuff_CheckedChanged); GroupBoxes[buff.Group].Controls.Add(checkBox); checkBox.BringToFront(); // only add Draenei Heroic Presence buff if Alliance /*if (buff.Name.Equals("Heroic Presence") && FormMain.Instance.IsHandleCreated) * { * if (FormMain.Instance.Character.Faction == CharacterFaction.Alliance) * CheckBoxes.Add(buff, checkBox); * else * checkBox.Enabled = false; * } * else * CheckBoxes.Add(buff, checkBox);*/ CheckBoxes.Add(buff, checkBox); foreach (Buff improvement in buff.Improvements) { if (Character == null || !Rawr.Properties.GeneralSettings.Default.HideProfEnchants || Character.HasProfession(improvement.Professions)) { ExtendedToolTipCheckBox checkBoxImprovement = new ExtendedToolTipCheckBox(); checkBoxImprovement.Tag = improvement; if (Rawr.Properties.GeneralSettings.Default.DisplayBuffSource && improvement.Source != null) { checkBoxImprovement.Text = improvement.Name + " (" + improvement.Source + ")"; } else { checkBoxImprovement.Text = improvement.Name; } checkBoxImprovement.Padding = new Padding(8 + checkBoxImprovement.Padding.Left, checkBoxImprovement.Padding.Top, checkBoxImprovement.Padding.Right, checkBoxImprovement.Padding.Bottom); checkBoxImprovement.AutoSize = true; checkBoxImprovement.Font = this.Font; checkBoxImprovement.Dock = DockStyle.Top; checkBoxImprovement.ToolTipText = improvement.Stats.ToString(); checkBoxImprovement.CheckedChanged += new EventHandler(checkBoxBuff_CheckedChanged); GroupBoxes[buff.Group].Controls.Add(checkBoxImprovement); checkBoxImprovement.BringToFront(); CheckBoxes.Add(improvement, checkBoxImprovement); } } } } foreach (GroupBox groupBox in GroupBoxes.Values) { // Make sure not to index an empty array if (groupBox.Controls.Count > 0) { groupBox.Height = groupBox.Controls[0].Bottom + 2; } // Hide empty group boxes else { groupBox.Hide(); } } ScrollHook.hookRec(this); this.ResumeLayout(); }
private void BuildControls() { this.Controls.Clear(); GroupBoxes.Clear(); LabelLabels.Clear(); ValueLabels.Clear(); string[] displayLabelConfigurationStrings = null; if (Calculations.Instance != null) { displayLabelConfigurationStrings = Calculations.CharacterDisplayCalculationLabels; } else { displayLabelConfigurationStrings = new string[0]; } this.SuspendLayout(); foreach (string displayLabelConfigurationString in displayLabelConfigurationStrings) { string[] displayLabelConfigurationSplit = displayLabelConfigurationString.Split(':'); string group = displayLabelConfigurationSplit[0]; if (!GroupBoxes.ContainsKey(group)) { GroupBox groupBox = new GroupBox(); groupBox.Text = group; groupBox.Tag = group; groupBox.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right; groupBox.Dock = DockStyle.Top; GroupBoxes.Add(group, groupBox); this.Controls.Add(groupBox); groupBox.BringToFront(); } string name = displayLabelConfigurationSplit[1]; string[] nameSplit = name.Split('*'); name = nameSplit[0]; ExtendedToolTipLabel labelLabel = new ExtendedToolTipLabel(); labelLabel.Left = 4; labelLabel.Text = name + (nameSplit.Length > 1 ? ": *" : ":"); labelLabel.AutoSize = true; GroupBoxes[group].Controls.Add(labelLabel); LabelLabels.Add(name, labelLabel); if (nameSplit.Length > 1) { labelLabel.ToolTipText = nameSplit[1]; } ExtendedToolTipLabel labelValue = new ExtendedToolTipLabel(); labelValue.Left = this.Width / 2; labelValue.AutoSize = true; GroupBoxes[group].Controls.Add(labelValue); ValueLabels.Add(name, labelValue); } int groupY = 3; foreach (GroupBox groupBox in GroupBoxes.Values) { int labelY = 19; foreach (ExtendedToolTipLabel label in groupBox.Controls) { label.Top = labelY; if (ValueLabels.ContainsValue(label)) { labelY += 18; } } groupBox.Bounds = new Rectangle(6, groupY, 202, labelY); groupY += labelY + 6; } this.ResumeLayout(); }
public void ShowBox(GroupBox box) { box.BringToFront(); }
private void addDependent() { GroupBox box = new GroupBox(); Label lbNameDependent = new Label(); Label lbDtnDependent = new Label(); Label lbRelationDependent = new Label(); TextBox txtNameDependent = new TextBox(); MaskedTextBox txtDtnDependent = new MaskedTextBox(); ComboBox cboRelationDependent = new ComboBox(); Button btnDelete = new Button(); pnDependents.Controls.Add(box); box.Name = "dependent" + groupNum.ToString(); box.Text = "Dependente " + groupNum.ToString(); box.Width = 498; box.Height = 100; box.Location = new Point(18, i + 44); box.Dock = DockStyle.Top; box.BringToFront(); box.Controls.Add(lbNameDependent); lbNameDependent.Name = "lbNameDependent" + groupNum.ToString(); lbNameDependent.Text = "Nome:"; lbNameDependent.Font = new Font("Lucida Sans Unicode", 12, FontStyle.Bold); lbNameDependent.Location = new Point(6, 22); lbNameDependent.AutoSize = true; box.Controls.Add(lbDtnDependent); lbDtnDependent.Name = "lbDtnDependent" + groupNum.ToString(); lbDtnDependent.Text = "Nascimento:"; lbDtnDependent.Font = new Font("Lucida Sans Unicode", 12, FontStyle.Bold); lbDtnDependent.Location = new Point(4, 66); lbDtnDependent.AutoSize = true; box.Controls.Add(lbRelationDependent); lbRelationDependent.Name = "lbRelationDependent" + groupNum.ToString(); lbRelationDependent.Text = "Relação"; lbRelationDependent.Font = new Font("Lucida Sans Unicode", 12, FontStyle.Bold); lbRelationDependent.Location = new Point(223, 66); lbRelationDependent.AutoSize = true; box.Controls.Add(txtNameDependent); txtNameDependent.Name = "txtNameDependent" + groupNum.ToString(); txtNameDependent.Text = ""; txtNameDependent.Font = new Font("Lucida Sans Unicode", 10, FontStyle.Regular); txtNameDependent.Location = new Point(81, 19); txtNameDependent.Size = new Size(370, 28); textBoxes.Add(txtNameDependent); box.Controls.Add(txtDtnDependent); txtDtnDependent.Name = "txtDtnDependent" + groupNum.ToString(); txtDtnDependent.Text = ""; txtDtnDependent.Mask = "00/00/0000"; txtDtnDependent.Font = new Font("Lucida Sans Unicode", 10, FontStyle.Regular); txtDtnDependent.Location = new Point(129, 62); txtDtnDependent.Size = new Size(88, 28); maskedTextBoxes.Add(txtDtnDependent); box.Controls.Add(cboRelationDependent); cboRelationDependent.Name = "cboRelationDependent" + groupNum.ToString(); cboRelationDependent.Font = new Font("Lucida Sans Unicode", 10, FontStyle.Regular); cboRelationDependent.Location = new Point(312, 62); cboRelationDependent.Size = new Size(139, 24); cboRelationDependent.Items.Add("Cônjuge"); cboRelationDependent.Items.Add("Pai / Mãe"); cboRelationDependent.Items.Add("Filho(a)"); comboBoxes.Add(cboRelationDependent); box.Controls.Add(btnDelete); btnDelete.Name = "btnDelete" + groupNum.ToString(); btnDelete.Location = new Point(460, 10); btnDelete.Size = new Size(34, 23); btnDelete.BackgroundImage = Properties.Resources.iconMenos; btnDelete.BackgroundImageLayout = ImageLayout.Stretch; btnDelete.BackColor = Color.Transparent; btnDelete.FlatStyle = FlatStyle.Flat; btnDelete.FlatAppearance.BorderSize = 0; btnDelete.Click += delegate(object send, EventArgs ex) { deleteBox(send, ex, box.Name); }; if (dependentsList.Count > 0 && groupNum < dependentsList.Count) { txtNameDependent.Text = dependentsList[groupNum].name; txtDtnDependent.Text = dependentsList[groupNum].dtn; cboRelationDependent.Text = dependentsList[groupNum].relation; } if (plans.type == "Familia") { if (groupNum > 5) { txtAditional.Text = ((groupNum - 5) * 9.90).ToString(); } } else { txtAditional.Text = ((groupNum) * 9.90).ToString(); } i = i + 106; groupNum = groupNum + 1; }
private GroupBox CreateCardVisuel(int leftValue, string name, string imgUrl, string descString, string id, string ideoString, bool isPassive, string attaque, bool isEnnemy = false) { GroupBox card = new GroupBox(); if (isEnnemy) { card.Top = 0; } else { card.Top = topNormal; } card.Text = name; card.Width = widthNormal; card.Height = HeightNormal; card.Left = leftValue; card.Tag = id; card.MouseHover += new EventHandler(HoverCard_Click); card.Click += new EventHandler(SelectCard_Click); PictureBox img = new PictureBox(); img.Image = Image.FromFile(imgUrl); img.Top = 20; img.SizeMode = PictureBoxSizeMode.StretchImage; img.Left = LeftImgNormal; img.Width = widthImgNormal; img.Height = HeighImgNormal; img.Tag = id; img.MouseHover += new EventHandler(HoverCard_Click); img.Click += new EventHandler(SelectCard_Click); Label desc = new Label(); desc.Text = descString; desc.Top = 160; desc.Left = 10; desc.Tag = id; desc.MouseHover += new EventHandler(HoverCard_Click); desc.Click += new EventHandler(SelectCard_Click); Label ideo = new Label(); ideo.Text = "Coût de point d'idéo: " + ideoString; ideo.Top = 200; ideo.Width = 120; ideo.Left = 10; ideo.Tag = id; ideo.MouseHover += new EventHandler(HoverCard_Click); ideo.Click += new EventHandler(SelectCard_Click); Label AttquePassive = new Label(); if (isPassive) { AttquePassive.Text = "Passive: " + attaque.ToString(); } else { AttquePassive.Text = "Attque: " + attaque.ToString(); } AttquePassive.Top = 200; AttquePassive.Left = 190; AttquePassive.Tag = id; AttquePassive.MouseHover += new EventHandler(HoverCard_Click); AttquePassive.Click += new EventHandler(SelectCard_Click); if (isPassive) { card.ForeColor = Color.Blue; } else { card.ForeColor = Color.DarkRed; } card.BringToFront(); card.Controls.Add(ideo); card.Controls.Add(AttquePassive); card.Controls.Add(desc); card.Controls.Add(img); return(card); }
}//right menu private void Wwwww(GroupBox groupBox) { groupBox.Visible = true; groupBox.BringToFront(); groupBox.Location = new Point(12, 27); }//left menu
private void BuildControls() { this.Controls.Clear(); this.GroupBoxes.Clear(); this.CheckBoxes.Clear(); this.SuspendLayout(); List <Buff> buffs = CalculationsHunter.RelevantPetBuffs; foreach (Buff buff in buffs) { if (!GroupBoxes.ContainsKey(buff.Group)) { GroupBox groupBox = new GroupBox(); groupBox.Text = buff.Group; groupBox.Tag = buff.Group; groupBox.Font = new Font(this.Font.FontFamily, 7f); groupBox.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right; groupBox.MouseMove += new MouseEventHandler(BuffSelector_MouseMove); groupBox.Dock = DockStyle.Top; GroupBoxes.Add(buff.Group, groupBox); this.Controls.Add(groupBox); groupBox.BringToFront(); } } foreach (Buff buff in buffs) { ExtendedToolTipCheckBox checkBox = new ExtendedToolTipCheckBox(); checkBox.Tag = buff; if (Rawr.Properties.GeneralSettings.Default.DisplayBuffSource && buff.Source != null) { checkBox.Text = buff.Name + " (" + buff.Source + ")"; } else { checkBox.Text = buff.Name; } checkBox.AutoSize = true; checkBox.Font = this.Font; checkBox.Dock = DockStyle.Top; checkBox.ToolTipText = buff.Stats.ToString(); checkBox.CheckedChanged += new EventHandler(checkBoxBuff_CheckedChanged); GroupBoxes[buff.Group].Controls.Add(checkBox); checkBox.BringToFront(); CheckBoxes.Add(buff, checkBox); foreach (Buff improvement in buff.Improvements) { ExtendedToolTipCheckBox checkBoxImprovement = new ExtendedToolTipCheckBox(); checkBoxImprovement.Tag = improvement; if (Rawr.Properties.GeneralSettings.Default.DisplayBuffSource && improvement.Source != null) { checkBoxImprovement.Text = improvement.Name + " (" + improvement.Source + ")"; } else { checkBoxImprovement.Text = improvement.Name; } checkBoxImprovement.Padding = new Padding(8 + checkBoxImprovement.Padding.Left, checkBoxImprovement.Padding.Top, checkBoxImprovement.Padding.Right, checkBoxImprovement.Padding.Bottom); checkBoxImprovement.AutoSize = true; checkBoxImprovement.Font = this.Font; checkBoxImprovement.Dock = DockStyle.Top; checkBoxImprovement.ToolTipText = improvement.Stats.ToString(); checkBoxImprovement.CheckedChanged += new EventHandler(checkBoxBuff_CheckedChanged); GroupBoxes[buff.Group].Controls.Add(checkBoxImprovement); checkBoxImprovement.BringToFront(); CheckBoxes.Add(improvement, checkBoxImprovement); } } foreach (GroupBox groupBox in GroupBoxes.Values) { groupBox.Height = groupBox.Controls[0].Bottom + 2; } UpdateEnabledStates(); this.ResumeLayout(); }
private void BuildControls() { this.Controls.Clear(); this.GroupBoxes.Clear(); this.CheckBoxes.Clear(); this.SuspendLayout(); foreach (Buff.BuffCategory category in Enum.GetValues(typeof(Buff.BuffCategory))) { GroupBox groupBox = new GroupBox(); groupBox.Text = Buff.GetBuffCategoryFriendlyName(category); groupBox.Tag = category; groupBox.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right; groupBox.MouseMove += new MouseEventHandler(BuffSelector_MouseMove); groupBox.Dock = DockStyle.Top; GroupBoxes.Add(category, groupBox); this.Controls.Add(groupBox); groupBox.BringToFront(); } foreach (Buff buff in Buff.GetAllRelevantBuffs()) { ExtendedToolTipCheckBox checkBox = new ExtendedToolTipCheckBox(); checkBox.Tag = buff; if (string.IsNullOrEmpty(buff.RequiredBuff)) { checkBox.Text = buff.Name; } checkBox.AutoSize = true; checkBox.ToolTipText = buff.Stats.ToString(); checkBox.CheckedChanged += new EventHandler(checkBoxBuff_CheckedChanged); GroupBoxes[buff.Category].Controls.Add(checkBox); CheckBoxes.Add(buff, checkBox); } int groupY = 3; foreach (GroupBox groupBox in GroupBoxes.Values) { int checkY = 19; foreach (CheckBox checkBox in groupBox.Controls) { Buff buff = checkBox.Tag as Buff; if (string.IsNullOrEmpty(buff.RequiredBuff)) { checkBox.Location = new Point(6, checkY); checkY += 23; } } groupBox.Bounds = new Rectangle(3, groupY, this.Width, checkY); groupY += checkY + 6; bool hasImprovedBuffs = false; foreach (CheckBox checkBox in groupBox.Controls) { Buff buff = checkBox.Tag as Buff; if (!string.IsNullOrEmpty(buff.RequiredBuff)) { hasImprovedBuffs = true; foreach (CheckBox requiredCheckBox in groupBox.Controls) { if (requiredCheckBox.Text == buff.RequiredBuff) { checkBox.Location = new Point(this.Width - this.Width / 4 - checkBox.Width / 2, requiredCheckBox.Top + 1); break; } } } } if (hasImprovedBuffs) { Label labelImproved = new Label(); labelImproved.Text = "Improved"; labelImproved.AutoSize = true; labelImproved.Location = new Point(this.Width - (4 * labelImproved.Width) / 5, 6); groupBox.Controls.Add(labelImproved); } } this.ResumeLayout(); }