private void AddItem(string title, string description, string type, string dateCreated) { //get a reference to the previous existent RowStyle temp = tableLayoutPanel1.RowStyles[tableLayoutPanel1.RowCount - 1]; //increase panel rows count by one tableLayoutPanel1.RowCount++; //add a new RowStyle as a copy of the previous one tableLayoutPanel1.RowStyles.Add(new RowStyle(temp.SizeType, temp.Height)); //add your three controls tableLayoutPanel1.Controls.Add(new Label() { Text = title, Cursor = Cursors.Hand }, 0, tableLayoutPanel1.RowCount - 1); tableLayoutPanel1.Controls.Add(new Label() { Text = description }, 1, tableLayoutPanel1.RowCount - 1); tableLayoutPanel1.Controls.Add(new Label() { Text = type }, 2, tableLayoutPanel1.RowCount - 1); tableLayoutPanel1.Controls.Add(new Label() { Text = dateCreated }, 3, tableLayoutPanel1.RowCount - 1); }
public void agregarfila(String id, String tipo, String ambito, String posicion, String peso) { RowStyle temp = TablaS.RowStyles[0]; TablaS.RowStyles.Add(new RowStyle(temp.SizeType, temp.Height)); TablaS.Controls.Add(new Label() { Text = id }, 0, TablaS.RowCount - 2); TablaS.Controls.Add(new Label() { Text = tipo }, 1, TablaS.RowCount - 2); TablaS.Controls.Add(new Label() { Text = ambito }, 2, TablaS.RowCount - 2); TablaS.Controls.Add(new Label() { Text = posicion }, 3, TablaS.RowCount - 2); TablaS.Controls.Add(new Label() { Text = peso }, 4, TablaS.RowCount - 2); TablaS.RowCount++; }
private void BtnTaskNumber_Click(object sender, EventArgs e) { ClearPanelControl(tblTaskPanel); btnCreateTask.Visible = true; int TaskCount = int.Parse(txtTaskNumber.Text.Trim()); tblTaskPanel.Visible = false; for (int i = 0; i < TaskCount; i++) { tblTaskPanel .RowStyles.Add(new RowStyle(SizeType.AutoSize, 40F)); RowStyle temp = tblTaskPanel.RowStyles[tblTaskPanel.RowCount - 1]; Label lblTask = new Label(); lblTask.Dock = DockStyle.Bottom; lblTask.Text = "Name For Task " + (i + 1); lblTask.Width = 100; tblTaskPanel.Controls.Add(lblTask, 0, i + 2); TextBox txtTask = new TextBox(); txtTask.Text = ""; txtTask.MinimumSize = new Size(200, 20); txtTask.TabIndex = btnTaskNumber.TabIndex + i + 1; tblTaskPanel.Controls.Add(txtTask, 1, i + 2); tblTaskPanel.RowCount = tblTaskPanel.RowCount + 1; // tblTaskPanel.RowStyles.Add(new RowStyle(temp.SizeType, temp.Height)); } tblTaskPanel.RowCount = tblTaskPanel.RowCount + 1; tblTaskPanel.Controls.Add(btnCreateTask, 1, tblTaskPanel.RowCount); //tblTaskPanel.Controls.Add(panel); tblTaskPanel.Visible = true; }
internal ICellStyle CreateCellStyle(RowStyle rowStyle) { IColor borderColor = this.CreateColor(rowStyle.BorderColor); IColor backColor = this.CreateColor(rowStyle.BackColor); IFont font = this.CreateFont(rowStyle); ICellStyle cellStyle; switch (this.ExcelVersion) { case ExcelVersion.XLS: { XLSStrategyStyle xLSStrategyStyle = new XLSStrategyStyle(this.ExcelXls); cellStyle = xLSStrategyStyle.GetCellStyle(backColor, borderColor, font); break; } case ExcelVersion.XLSX: { XLSXStrategyStyle xLSXStrategyStyle = new XLSXStrategyStyle(this.ExcelXlsx); cellStyle = xLSXStrategyStyle.GetCellStyle(backColor, borderColor, font); break; } default: throw new Exception(ErrorMessage.Excel_BadVersion); } return(cellStyle); }
void sizeRow(int newHeight) { // change the height of one row if (newHeight == 0) { return; } if (sizingRow < 0) { return; } SuspendLayout(); rowHeights = GetRowHeights(); if (sizingRow >= rowHeights.Length) { return; } if (newHeight > 0) { RowStyles[sizingRow] = new RowStyle(SizeType.Absolute, newHeight); } ResumeLayout(); rowHeights = GetRowHeights(); getRowRectangles(SplitterSize); }
internal IFont CreateFont(RowStyle rowStyle) { IColor fontColor = this.CreateColor(rowStyle.FontColor); IFont font; switch (this.ExcelVersion) { case ExcelVersion.XLS: { XLSStrategyStyle xLSStrategyStyle = new XLSStrategyStyle(this.ExcelXls); font = xLSStrategyStyle.GetFont(rowStyle.FontSize, rowStyle.FontName, fontColor); break; } case ExcelVersion.XLSX: { XLSXStrategyStyle xLSXStrategyStyle = new XLSXStrategyStyle(this.ExcelXlsx); font = xLSXStrategyStyle.GetFont(rowStyle.FontSize, rowStyle.FontName, fontColor); break; } default: throw new Exception(ErrorMessage.Excel_BadVersion); } return(font); }
public void RowStyle_Ctor_SizeType_Float(SizeType sizeType, float width) { var style = new RowStyle(sizeType, width); Assert.Equal(sizeType, style.SizeType); Assert.Equal(width, style.Height); }
public void RowStyle_Height_SetWithOwner_GetReturnsExpected(float value, int expectedLayoutCallCount) { using var control = new TableLayoutPanel(); var style = new RowStyle(); control.LayoutSettings.RowStyles.Add(style); int layoutCallCount = 0; control.Layout += (sender, e) => { Assert.Same(control, sender); Assert.Same(control, e.AffectedControl); Assert.Equal("Style", e.AffectedProperty); layoutCallCount++; }; style.Height = value; Assert.Equal(value, style.Height); Assert.Equal(expectedLayoutCallCount, layoutCallCount); Assert.False(control.IsHandleCreated); // Set same. style.Height = value; Assert.Equal(value, style.Height); Assert.Equal(expectedLayoutCallCount, layoutCallCount); Assert.False(control.IsHandleCreated); }
public void RowStyle_Ctor_Default() { var style = new RowStyle(); Assert.Equal(SizeType.AutoSize, style.SizeType); Assert.Equal(0, style.Height); }
private void button1_Click(object sender, EventArgs e) { if (groupTable.RowCount <= 10) { RowStyle temp = groupTable.RowStyles[groupTable.RowCount - 1]; groupTable.RowCount++; if (groupTable.RowCount == 10) { button1.Enabled = false; } groupTable.RowStyles.Add(new RowStyle(temp.SizeType, temp.Height)); groupTable.Controls.Add(new TextBox() { Dock = DockStyle.Fill }, 0, groupTable.RowCount - 1); groupTable.Controls.Add(new TextBox() { Dock = DockStyle.Fill }, 1, groupTable.RowCount - 1); groupTable.Controls.Add(new TextBox() { Dock = DockStyle.Fill }, 2, groupTable.RowCount - 1); } }
private void setStyleTLPParamMain() { RowStyle rowStyle01, rowStyle02, rowStyle03; ColumnStyle columnStyle01, columnStyle02, columnStyle03; rowStyle01 = new RowStyle(); rowStyle02 = new RowStyle(); rowStyle03 = new RowStyle(); columnStyle01 = new ColumnStyle(); columnStyle02 = new ColumnStyle(); columnStyle03 = new ColumnStyle(); rowStyle01.SizeType = SizeType.Percent; rowStyle02.SizeType = SizeType.Percent; rowStyle03.SizeType = SizeType.Percent; columnStyle01.SizeType = SizeType.Percent; columnStyle02.SizeType = SizeType.Percent; columnStyle03.SizeType = SizeType.Percent; rowStyle01.Height = 9; rowStyle02.Height = 81; rowStyle03.Height = 10; columnStyle01.Width = 45; columnStyle02.Width = 45; columnStyle03.Width = 10; tLPParamMain.RowStyles.Add(rowStyle01); tLPParamMain.RowStyles.Add(rowStyle02); tLPParamMain.RowStyles.Add(rowStyle03); tLPParamMain.ColumnStyles.Add(columnStyle01); tLPParamMain.ColumnStyles.Add(columnStyle02); tLPParamMain.ColumnStyles.Add(columnStyle03); }
public void CtorTest1() { RowStyle rs = new RowStyle(); Assert.AreEqual(0.0f, rs.Height, "1"); Assert.AreEqual(SizeType.AutoSize, rs.SizeType, "2"); }
/// <summary> /// Creates the row style. /// </summary> /// <param name="styleNode">The style node.</param> private void CreateRowStyle(XmlNode styleNode) { RowStyle rowStyle = new RowStyle(this._document); rowStyle.Node = styleNode.CloneNode(true); IPropertyCollection pCollection = new IPropertyCollection(); if (styleNode.HasChildNodes) { foreach (XmlNode node in styleNode.ChildNodes) { IProperty property = this.GetProperty(rowStyle, node.CloneNode(true)); if (property != null) { pCollection.Add(property); } } } rowStyle.Node.InnerXml = ""; foreach (IProperty property in pCollection) { rowStyle.PropertyCollection.Add(property); } if (!this._common) { this._document.Styles.Add(rowStyle); } else { this._document.CommonStyles.Add(rowStyle); } }
private void AddFuWuType_Load(object sender, EventArgs e) { List <string> list = new List <string>(); //返回会员卡的类型的名字 list = bll.selectNodes(); list.Insert(0, "无卡"); tableLayoutPanel1.Height = (list.Count + 1) * 40; RowStyle row; Label lab1; TextBox teb1; //row = new RowStyle(SizeType.Absolute,40); lab1 = new Label(); lab1.Text = "服务类别名称"; teb1 = new TextBox(); tableLayoutPanel1.Controls.Add(lab1, 0, 0); tableLayoutPanel1.Controls.Add(teb1, 1, 0); foreach (var i in list) { lab1 = new Label(); lab1.Text = i; teb1 = new TextBox(); row = new RowStyle(SizeType.Absolute, 40); tableLayoutPanel1.Controls.Add(lab1, 0, tableLayoutPanel1.RowStyles.Count - 1); tableLayoutPanel1.Controls.Add(teb1, 1, tableLayoutPanel1.RowStyles.Count - 1); tableLayoutPanel1.RowStyles.Add(row); } }
/// <summary> /// Constructor /// </summary> /// <param name="info"> /// The country information to represent on the map /// </param> public MapView(IReadOnlyList <CountryInfoEx> info) { _countries = info; _tableLayoutPanel.Dock = DockStyle.Fill; _tableLayoutPanel.RowCount = 2; RowStyle mapRow = new RowStyle(); mapRow.SizeType = SizeType.Percent; mapRow.Height = 95; _tableLayoutPanel.RowStyles.Add(mapRow); RowStyle slideRow = new RowStyle(); slideRow.SizeType = SizeType.Percent; slideRow.Height = 5; _tableLayoutPanel.RowStyles.Add(slideRow); InitializeMap(info); InitializeBottomLayout(); _tableLayoutPanel.Controls.Add(_geoMap, 0, 0); _tableLayoutPanel.Controls.Add(_TableLayoutPanelBottom); _tabPage.Controls.Add(_tableLayoutPanel); }
//////////////////////////////add//////////////////////////////// private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (selected == "تخدير") { if (tableLayoutPanel1.RowCount > l1.Count) { l1.Add(t1.Text); } } if (selected == "جراح مساعد") { if (tableLayoutPanel1.RowCount > l2.Count) { l2.Add(t1.Text); } } if (selected == "تمريض") { if (tableLayoutPanel1.RowCount > l3.Count) { l3.Add(t1.Text); } } t1 = new TextBox(); t2 = new TextBox(); b1 = new Button(); b1.Click += b1_Click; t1.Size = textBox1.Size; t1.Location = textBox1.Location; t1.Font = textBox1.Font; t2.Size = textBox2.Size; t2.Location = textBox2.Location; t2.Font = textBox2.Font; b1.Size = button1.Size; b1.Location = button1.Location; b1.BackgroundImage = button1.BackgroundImage; b1.Margin = button1.Margin; this.tableLayoutPanel1.AutoSize = true; if (tableLayoutPanel1.RowCount > 0) { temp = tableLayoutPanel1.RowStyles[0]; } else { temp = temp1; } this.tableLayoutPanel1.RowStyles.Add(new RowStyle(temp.SizeType, temp.Height)); tableLayoutPanel1.RowCount++; this.tableLayoutPanel1.Controls.Add(t1, 2, rowIndex); this.tableLayoutPanel1.Controls.Add(b1, 1, rowIndex); this.tableLayoutPanel1.Controls.Add(t2, 0, rowIndex); rowIndex++; }
public void AddToTable(TableLayoutPanel table, int row) { table.SuspendLayout(); table.Controls.Add(Name, 0, row); table.Controls.Add(Level, 1, row); table.Controls.Add(HP, 2, row); table.Controls.Add(Condition, 3, row); table.Controls.Add(ShipResource, 4, row); table.Controls.Add(Equipments, 5, row); table.ResumeLayout(); #region set RowStyle RowStyle rs = new RowStyle(SizeType.Absolute, 21); if (table.RowStyles.Count > row) { table.RowStyles[row] = rs; } else { while (table.RowStyles.Count <= row) { table.RowStyles.Add(rs); } } #endregion }
// použití tablelayoutpanelu (obdobné jako Java Grid Layout) aplikace se nehorázně zasekává -> ukázka automatického resizování buňěk // imho je lepší použít klasický panel, práce s tablelayoutpanelem je sice jednodušší a //nastaví si sám velikost jednotlivých buněk, avšak hrozně se to seká, nedoporučuju používat pro tyto účely (snažil sem se aby byl výsledek shodný ve všech jazycích) public void createField() { _form.field = new TableLayoutPanel(); _form.field.CellBorderStyle = TableLayoutPanelCellBorderStyle.Outset; _form.field.AutoSize = true; _form.field.Dock = DockStyle.Fill; _form.field.GrowStyle = TableLayoutPanelGrowStyle.FixedSize; _form.field.ColumnCount = _xLength; _form.field.RowCount = _yLength; this.generateMines(); _buttons = new MineButton[_xLength, _yLength]; for (int y = 0; y < _yLength; y++) { // mění velikost řádku dle velikosti celé tabulky RowStyle rowstyle = new RowStyle(SizeType.Percent, (float)(100 / _xLength)); _form.field.RowStyles.Add(rowstyle); for (int x = 0; x < _xLength; x++) { // mení velikost sloupce v závislosti na celé tabulce ColumnStyle colstyle = new ColumnStyle(SizeType.Percent, (float)(100 / _xLength)); _form.field.ColumnStyles.Add(colstyle); _buttons[x, y] = new MineButton(x, y); _buttons[x, y].MouseDown += new MouseEventHandler(Mines_MouseDown); _form.field.Controls.Add(_buttons[x, y], x, y); } } _form.Controls.Add(_form.field); }
//////////////////////////////remove//////////////////////////////// private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (tableLayoutPanel1.RowCount > 0) { if (tableLayoutPanel1.RowCount == 1) { temp1 = tableLayoutPanel1.RowStyles[0]; } tableLayoutPanel1.Controls.Remove(tableLayoutPanel1.GetControlFromPosition(0, tableLayoutPanel1.RowCount - 1)); tableLayoutPanel1.Controls.Remove(tableLayoutPanel1.GetControlFromPosition(1, tableLayoutPanel1.RowCount - 1)); tableLayoutPanel1.Controls.Remove(tableLayoutPanel1.GetControlFromPosition(2, tableLayoutPanel1.RowCount - 1)); tableLayoutPanel1.RowStyles.RemoveAt(tableLayoutPanel1.RowCount - 1); tableLayoutPanel1.RowCount--; rowIndex = tableLayoutPanel1.RowCount; } if (selected == "تخدير") { l1.Remove(l1[l1.Count - 1]); } if (selected == "جراح مساعد") { l2.Remove(l2[l2.Count - 1]); } if (selected == "تمريض") { l3.Remove(l3[l3.Count - 1]); } }
private void AddItem(Exercise exercise) { RowStyle temp = tblExercises.RowStyles[tblExercises.RowCount - 1]; tblExercises.RowCount++; tblExercises.RowStyles.Add(new RowStyle(temp.SizeType, temp.Height)); tblExercises.Controls.Add(new Label() { Text = exercise.ExerciseName }, 0, tblExercises.RowCount - 1); tblExercises.Controls.Add(new Label() { Text = exercise.ExerciseSet.ToString() + " x " + exercise.ExerciseRep.ToString() }, 1, tblExercises.RowCount - 1); tblExercises.Controls.Add(new Label() { Text = exercise.Part.PartName }, 2, tblExercises.RowCount - 1); tblExercises.Controls.Add(new Label() { Text = exercise.ExerciseDesc }, 2, tblExercises.RowCount - 1); }
public void HeightTest1() { RowStyle rs = new RowStyle(); rs.Height = 1.0f; Assert.AreEqual(1.0f, rs.Height, "1"); }
public void CtorTest3() { RowStyle rs = new RowStyle(SizeType.Absolute, 5.0f); Assert.AreEqual(5.0, rs.Height, "1"); Assert.AreEqual(SizeType.Absolute, rs.SizeType, "2"); }
private void AddItem(RangeValueItem item) { //1. validation if (item == null) { return; } RowStyle rs = new RowStyle(SizeType.Absolute, 30F); tlpItems.RowStyles.Insert(this._RowIndex, rs); var txt1 = this.CreateTextBox(item.LowerValue.ToString("F2")); this._TxtLowerLimit.Add(txt1); tlpItems.Controls.Add(txt1, 0, this._RowIndex); var txt2 = this.CreateTextBox(item.UpperValue.ToString("F2")); this._TxtUpperLimit.Add(txt2); tlpItems.Controls.Add(txt2, 1, this._RowIndex); var txt3 = this.CreateTextBox(item.Value.ToString("F2")); this._TxtValue.Add(txt3); tlpItems.Controls.Add(txt3, 2, this._RowIndex); ////button var btn = this.CreateDelLinkBtn(this._RowIndex); tlpItems.Controls.Add(btn, 3, this._RowIndex); ////Scroll tlpItems.RowCount++; tlpItems.Width -= 1; tlpItems.Refresh(); this._RowIndex++; }
public void AddToTable(TableLayoutPanel table, int row) { table.SuspendLayout(); table.Controls.Add(Name, 0, row); table.Controls.Add(ActionKind, 1, row); table.Controls.Add(AirSuperiority, 2, row); table.Controls.Add(Distance, 3, row); table.Controls.Add(Squadrons, 4, row); table.ResumeLayout(); #region set RowStyle RowStyle rs = new RowStyle(SizeType.Absolute, 21); if (table.RowStyles.Count > row) { table.RowStyles[row] = rs; } else { while (table.RowStyles.Count <= row) { table.RowStyles.Add(rs); } } #endregion }
private void AddItem(string Username, uint answeredQuestions, uint correctAns, uint wrongAns, uint avgTime) { //Keep the previous style saved RowStyle temp = ResultsPanel.RowStyles[ResultsPanel.RowCount - 1]; //increase panel rows count by one ResultsPanel.RowCount++; //add a new RowStyle as a copy of the previous one ResultsPanel.RowStyles.Add(new RowStyle(temp.SizeType, temp.Height)); //add labels ResultsPanel.Controls.Add(new Label() { Text = Username }, 0, ResultsPanel.RowCount - 1); ResultsPanel.Controls.Add(new Label() { Text = answeredQuestions.ToString() }, 1, ResultsPanel.RowCount - 1); ResultsPanel.Controls.Add(new Label() { Text = correctAns.ToString() }, 2, ResultsPanel.RowCount - 1); ResultsPanel.Controls.Add(new Label() { Text = wrongAns.ToString() }, 3, ResultsPanel.RowCount - 1); ResultsPanel.Controls.Add(new Label() { Text = avgTime.ToString() }, 4, ResultsPanel.RowCount - 1); }
public LanesContainer(ILanesDatabaseService lanesDatabaseService, ICardDatabaseService cardDatabaseService) { SetupToolTip(); InitializeComponent(); _lanesDatabaseService = lanesDatabaseService; _cardDatabaseService = cardDatabaseService; this.Dock = DockStyle.Fill; var mainLayoutPanel = new TableLayoutPanel() { Dock = DockStyle.Fill, Size = new Size(400, 800) }; var row1 = new RowStyle(SizeType.Absolute, 50); var row2 = new RowStyle(SizeType.Percent, 100); var columnStyle = new ColumnStyle(SizeType.Percent, 100); mainLayoutPanel.RowStyles.Add(row1); mainLayoutPanel.RowStyles.Add(row2); mainLayoutPanel.ColumnStyles.Add(columnStyle); mainLayoutPanel.Controls.Add(BuildMainMenu(), 0, 0); LanesCollection = new List <Lane>(); _layoutPanel = new FlowLayoutPanel { FlowDirection = FlowDirection.LeftToRight, Dock = DockStyle.Fill, WrapContents = false, HorizontalScroll = { Enabled = true }, AutoScroll = true, Size = new Size(this.Width, 800) }; this.Controls.Add(_layoutPanel); this.Resize += LanesContainer_Resize; mainLayoutPanel.Controls.Add(_layoutPanel, 0, 1); this.Controls.Add(mainLayoutPanel); }
public void AddToTable(TableLayoutPanel table) { table.SuspendLayout(); table.Controls.Add(Name, 0, 0); table.Controls.Add(StateMain, 1, 0); table.Controls.Add(AirSuperiority, 2, 0); table.Controls.Add(SearchingAbility, 3, 0); table.ResumeLayout(); int row = 0; #region set RowStyle RowStyle rs = new RowStyle(SizeType.Absolute, 21); if (table.RowStyles.Count > row) { table.RowStyles[row] = rs; } else { while (table.RowStyles.Count <= row) { table.RowStyles.Add(rs); } } #endregion }
public void RowStyle_Ctor_SizeType(SizeType sizeType) { var style = new RowStyle(sizeType); Assert.Equal(sizeType, style.SizeType); Assert.Equal(0, style.Height); }
public void RowStyle_Ctor_SizeType_Float(SizeType sizeType, float height) { var style = new RowStyle(sizeType, height); Assert.Equal(sizeType, style.SizeType); Assert.Equal(height, style.Height); }
private void InitListView() { this.columnsAndRowsListView.Items.Clear(); string str = this.isRowCollection ? "Row" : "Column"; int num = this.isRowCollection ? this.tlp.RowStyles.Count : this.tlp.ColumnStyles.Count; for (int i = 0; i < num; i++) { string str2; string str3; if (this.isRowCollection) { RowStyle style = this.tlp.RowStyles[i]; str2 = style.SizeType.ToString(); str3 = this.FormatValueString(style.SizeType, style.Height); } else { ColumnStyle style2 = this.tlp.ColumnStyles[i]; str2 = style2.SizeType.ToString(); str3 = this.FormatValueString(style2.SizeType, style2.Width); } string[] items = new string[] { str + ((i + 1)).ToString(CultureInfo.InvariantCulture), str2, str3 }; this.columnsAndRowsListView.Items.Add(new ListViewItem(items)); } if (num > 0) { this.ClearAndSetSelectionAndFocus(0); } this.removeButton.Enabled = this.columnsAndRowsListView.Items.Count > 1; }
public void Insert(int index, RowStyle rowStyle) { }
public void Remove(RowStyle rowStyle) { }
public bool Contains(RowStyle rowStyle) { }
public int IndexOf(RowStyle rowStyle) { }
public void AddRow(RowStyle style, params object[] values) { _rows.Add(new Row {Style = style, Values = values}); }
// Methods public int Add(RowStyle rowStyle) { }