本文整理汇总了C#中System.Windows.Forms.TableLayoutPanel.GetControlFromPosition方法的典型用法代码示例。如果您正苦于以下问题:C# TableLayoutPanel.GetControlFromPosition方法的具体用法?C# TableLayoutPanel.GetControlFromPosition怎么用?C# TableLayoutPanel.GetControlFromPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.TableLayoutPanel
的用法示例。
在下文中一共展示了TableLayoutPanel.GetControlFromPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DiffViewWrapper
public DiffViewWrapper(string name, Control parent, FdoCache cache,
IVwStylesheet styleSheet, DiffViewScrProxy currentDraft, DiffViewScrProxy revisionDraft,
DiffViewFootnoteProxy currentFootnote, DiffViewFootnoteProxy revisionFootnote,
TableLayoutPanel otherControls) : base(cache, styleSheet, 4, 2)
{
Dock = DockStyle.Fill;
Name = name;
Parent = parent;
Padding = otherControls.Padding;
// Add the labels at the top
AddControl(null, kLabelRow, kRevisionColumn, new FixedControlProxy(
otherControls.GetControlFromPosition(kRevisionColumn, kLabelRow)));
AddControl(null, kLabelRow, kCurrentColumn, new FixedControlProxy(
otherControls.GetControlFromPosition(kCurrentColumn, kLabelRow)));
// Add the views
AddControl(null, kDraftRow, kRevisionColumn, revisionDraft, false, true);
AddControl(null, kDraftRow, kCurrentColumn, currentDraft, true, true);
AddControl(null, kFootnoteRow, kRevisionColumn, revisionFootnote, false, true);
AddControl(null, kFootnoteRow, kCurrentColumn, currentFootnote, false, true);
// Add the buttons below the views
AddControl(null, kButtonRow, kRevisionColumn, new FixedControlProxy(
otherControls.GetControlFromPosition(kRevisionColumn, kButtonRow)));
AddControl(null, kButtonRow, kCurrentColumn, new FixedControlProxy(
otherControls.GetControlFromPosition(kCurrentColumn, kButtonRow)));
// Set properties on the rows
// We have to set the desired height first because this resets the visible
// state - strange.
GetRow(kLabelRow).MinimumHeight =
otherControls.GetControlFromPosition(kRevisionColumn, kLabelRow).Height;
GetRow(kButtonRow).MinimumHeight =
otherControls.GetControlFromPosition(kRevisionColumn, kButtonRow).Height;
DataGridViewControlRow row = GetRow(kLabelRow);
row.Visible = true;
row.Resizable = DataGridViewTriState.False;
row.IsAutoFill = false;
DataGridViewAdvancedBorderStyle noBorder = new DataGridViewAdvancedBorderStyle();
noBorder.All = DataGridViewAdvancedCellBorderStyle.None;
row.AdvancedBorderStyle = noBorder;
row = GetRow(kDraftRow);
row.Visible = true;
row = GetRow(kFootnoteRow);
row.FillWeight = 18; // 30%
row.Visible = false;
row = GetRow(kButtonRow);
row.Visible = true;
row.Resizable = DataGridViewTriState.False;
row.IsAutoFill = false;
row.AdvancedBorderStyle = noBorder;
// Set properties on the two columns
DataGridViewControlColumn column = GetColumn(kRevisionColumn);
column.MinimumWidth = 220;
column.Visible = true;
column.FillWeight = 100;
column.Name = "RevisionColumn";
column = GetColumn(kCurrentColumn);
column.MinimumWidth = 315;
column.Visible = true;
column.FillWeight = 100;
column.Name = "CurrentColumn";
}
示例2: Verify_Table_Entrys
// Checks all inputs in the named table to find any that have not been filled in.
private bool Verify_Table_Entrys(TableLayoutPanel tableName)
{
bool verified = true;
int numberOfRows = 0;
if (tableName.Name == "tableLayoutPanel_Match")
{
numberOfRows = tableName.RowCount;
}
else if (tableName.Name == "tableLayoutPanel_Away")
{
numberOfRows = currentTableRowAway;
}
else if (tableName.Name == "tableLayoutPanel_Home")
{
numberOfRows = currentTableRowHome;
}
// Check away team table entries
for (int i = 0; i < numberOfRows; i = i + 1)
{
// Gets the name of the control from the table
Control c = tableName.GetControlFromPosition(1, i);
Control d = tableName.GetControlFromPosition(2, i);
// If the control is in the Match table and is empty the method
if (String.IsNullOrWhiteSpace(c.Text))
{
d.Text = "*";
c.BackColor = Color.DarkOrange;
verified = false;
}
else
{
c.BackColor = Color.White;
d.Text = "";
}
}
return verified;
}
示例3: ResetGrid
private void ResetGrid(TableLayoutPanel grid)
{
for (int c = 0; c < grid.ColumnCount; c++)
{
for (int r = 0; r < grid.RowCount; r++)
{
pictureBox = (PictureBox)grid.GetControlFromPosition(c, r);
pictureBox.Image = Properties.Resources.Water;
pictureBox.Tag = "Water";
}
}
}
示例4: removeRow
/// <summary>
/// Removes a row from the scanner form table
/// </summary>
/// <param name="panel">The table control</param>
/// <param name="rowIndex">which row to remove</param>
private void removeRow(TableLayoutPanel panel, int rowIndex)
{
panel.RowStyles.RemoveAt(rowIndex);
for (int columnIndex = 0; columnIndex < panel.ColumnCount; columnIndex++)
{
var control = panel.GetControlFromPosition(columnIndex, rowIndex);
panel.Controls.Remove(control);
}
for (int i = rowIndex + 1; i < panel.RowCount; i++)
{
for (int columnIndex = 0; columnIndex < panel.ColumnCount; columnIndex++)
{
var control = panel.GetControlFromPosition(columnIndex, i);
panel.SetRow(control, i - 1);
}
}
panel.RowCount--;
}
示例5: GetControl
private static Control GetControl(TableLayoutPanel tableLayoutPanel, int col, int row)
{
Control control = tableLayoutPanel.GetControlFromPosition(col, row);
if (control == null)
{
control = new Label() { TextAlign = System.Drawing.ContentAlignment.MiddleLeft, Dock = DockStyle.Fill };
tableLayoutPanel.Controls.Add(control);
}
return control;
}
示例6: Verify_Table_Entrys
// Verify all table entrys in the supplied table. If entries missing, the user will not be able to move to next screen.
// This stops the application from falling over due to a null exception.
private bool Verify_Table_Entrys(TableLayoutPanel tableName)
{
bool verified = true;
// Check away team table entries
for (int i = 0; i < tableName.RowCount; i = i + 1)
{
Control c = tableName.GetControlFromPosition(1, i);
Control d = tableName.GetControlFromPosition(2, i);
if (String.IsNullOrWhiteSpace(c.Text))
{
d.Text = "*";
c.BackColor = Color.DarkOrange;
verified = false;
}
else
{
c.BackColor = Color.White;
d.Text = "";
}
}
return verified;
}
示例7: t_combo_SelectedIndexChanged
void t_combo_SelectedIndexChanged(object sender, EventArgs e)
{
TableLayoutPanelCellPosition pos = new TableLayoutPanelCellPosition();
Control ctr = new Control();
Control ctrParent = new Control();
TableLayoutPanel ctrGrandParent = new TableLayoutPanel();
TextBox t_txtBox2 = new TextBox();
ctr = (Control)sender; // cast combobox control
ctrParent = ctr.Parent; // get panel control
ctrGrandParent = (TableLayoutPanel)ctrParent.Parent; // get tablelayoutpanel control
pos = ctrGrandParent.GetPositionFromControl(ctrParent); // get panel position
if (ctrParent.Controls.Count < 2 & ctr.Text == "Other")
{
t_txtBox2.Location = new Point(3, 30);
t_txtBox2.Text = ctr.Tag.ToString();
ctrParent.Controls.Add(t_txtBox2);
}
else if (ctrParent.Controls.Count == 2 & ctr.Text != "Other")
{
ctrGrandParent.GetControlFromPosition(pos.Column, pos.Row).Controls.RemoveAt(1);
}
}
示例8: MoveRow
void MoveRow(int row, int offset, TableLayoutPanel targetPanel)
{
if (row + offset <= 0 || row + offset >= targetPanel.RowCount - 1)
return;
targetPanel.SuspendLayout();
for (int i = 0; i < targetPanel.ColumnCount - 1; i++)
{
Control currentControl = targetPanel.GetControlFromPosition(i, row);
Control offsetControl = targetPanel.GetControlFromPosition(i, row + offset);
targetPanel.SetCellPosition(currentControl, new TableLayoutPanelCellPosition(i, row + offset));
targetPanel.SetCellPosition(offsetControl, new TableLayoutPanelCellPosition(i, row));
}
//Re-layout label numbers
LayoutNumber(targetPanel);
targetPanel.ResumeLayout();
}
示例9: removeTier
private void removeTier(TableLayoutPanel table, char charge, String description)
{
tiers.RemoveAll(set => set.Equals(new CommonTools.Tier(charge, description)));
table.GetControlFromPosition(0, 0).Text = "";
for (int i = 1; i <= 5; i++) { table.GetControlFromPosition(i, 0).Text = "0.0000"; }
((ComboBox)table.GetControlFromPosition(0, 0)).Items.Remove(description);
statusBox();
}
示例10: button_SA_edit_PoD_Click
private void button_SA_edit_PoD_Click(object sender, EventArgs e)
{
ConnectToMySQL dbc = new ConnectToMySQL(user_id_lbl.Text, user_hash_lbl.Text);
List<string> fldVals = new List<string>();
List<string> addtFldVals = new List<string>();
TableLayoutPanel TLP = new TableLayoutPanel();
string[] str = new string[] { };
DataSet ds = new DataSet();
if (((Control)sender).Name == "button_SA_edit_PoD")
TLP = tableLayoutPanel1_SA_edit_addDetails;
else
TLP = (TableLayoutPanel)sender;
// setting up start column and adding remaining values like user_id, po number, cust name, req date, notes -->
int startColCount = 1;
if (TLP.GetControlFromPosition(0, 0).Tag != null)
{
startColCount = Int32.Parse(TLP.GetControlFromPosition(0, 0).Tag.ToString()) + 1; // get col count from 0,0 position tag.
string query = "SELECT cust_po_number, notes, cust_name, DATE_FORMAT(req_date, '%Y-%m-%d')";
query += " FROM sales_vars WHERE cust_po_number = '" + TLP.GetControlFromPosition(startColCount, 20).Tag.ToString() + "'; ";
ds = dbc.SelectMyDA(query);
addtFldVals.Add(user_id_lbl.Text);
for (int i = 0; i < ds.Tables[0].Rows[0].ItemArray.Length; i++)
addtFldVals.Add(ds.Tables[0].Rows[0].ItemArray[i].ToString());
}
else if(TLP.Name != "tableLayoutPanel1_SA_edit_addDetails")
{
addtFldVals.Add(user_id_lbl.Text);
addtFldVals.Add(textBox_Cust_PO_Num.Text);
addtFldVals.Add(textBox_Cust_Notes.Text);
addtFldVals.Add(textBox_Cust_Name.Text);
addtFldVals.Add(dateTimePicker_Cust_Req_Date.Value.Year.ToString() + "-" + dateTimePicker_Cust_Req_Date.Value.Month.ToString() + "-" + dateTimePicker_Cust_Req_Date.Value.Day.ToString());
}
// <--
// adding field values and inserting for po_details table -->
List<string> fldNames2 = new List<string>();
fldNames2.Add("user_id");
fldNames2.Add("cust_po_number");
fldNames2.Add("notes");
fldNames2.Add("cust_name");
fldNames2.Add("req_date");
for (int i = startColCount; i < TLP.ColumnCount; i++)
{
fldVals.Clear();
for (int j = 1; j <= 21; j++)
{
if (TLP.GetControlFromPosition(i, j).GetChildAtPoint(new Point(4, 6)).Text == "Other")
fldVals.Add(TLP.GetControlFromPosition(i, j).GetChildAtPoint(new Point(3, 30)).Text);
else
fldVals.Add(TLP.GetControlFromPosition(i, j).GetChildAtPoint(new Point(4, 6)).Text);
}
/*
string s = TLP.GetControlFromPosition(i, 21).Tag.ToString();
if (((Control)sender).Name == "button_SA_edit_PoD")
str = tableLayoutPanel1_SA_edit_addDetails.GetControlFromPosition(i, 21).Tag.ToString().Remove(TLP.GetControlFromPosition(i, 21).Tag.ToString().Length - 1).Split('&');
else
str = TLP.GetControlFromPosition(i, 21).Tag.ToString().Remove(TLP.GetControlFromPosition(i, 21).Tag.ToString().Length - 1).Split('&');
*/
fldVals.AddRange(addtFldVals.ToArray());
//if (fldNames.Count == 21)
// fldNames.RemoveAt(21);
if (fldNames.Count == 22)
fldNames.RemoveAt(21);
if (Int32.Parse(TLP.GetControlFromPosition(startColCount, 21).Tag.ToString()) == 0)
{
fldNames.AddRange(fldNames2);
dbc.Insert(fldNames, "sales_vars", fldVals, user_id_lbl.Text); // TODO: uncomment
fldNames2.Clear();
}
else
{
fldNames.AddRange(new string[] {"DataApproved", "ArtApproved" });
if (((CheckBox)TLP.GetControlFromPosition(i, 24)).CheckState == CheckState.Checked)
fldVals.Add("Y");
else
fldVals.Add("N");
if (((CheckBox)TLP.GetControlFromPosition(i, 25)).CheckState == CheckState.Checked)
fldVals.Add("Y");
else
fldVals.Add("N");
string query = "UPDATE sales_vars SET ";
for (int j = 0; j < fldNames.Count; j++)
{
query += fldNames[j] + " = '" + fldVals[j] + "'";
if (j != fldNames.Count - 1)
query += ", ";
}
query += " WHERE id ='" + TLP.GetControlFromPosition(i, 21).Tag.ToString() + "';";
dbc.Update(query); // TODO: uncomment
fldNames.RemoveAt(22);
}
}
//.........这里部分代码省略.........
示例11: displayTier
private void displayTier(TableLayoutPanel table, char charge, String description)
{
foreach (CommonTools.Tier set in tiers) {
if (set.Equals(new CommonTools.Tier(charge, description))) {
table.GetControlFromPosition(0, 0).Text = description;
for (int i = 1; i <= 5; i++) { table.GetControlFromPosition(i, 0).Text = set.getTier(i).ToString(); }
return;
}
}
for (int i = 1; i <= 5; i++) { table.GetControlFromPosition(i, 0).Text = "0.0000"; }
}
示例12: PripravFormularMesic
//.........这里部分代码省略.........
Text.KeyDown += ZpracujKlavesy;
Text.Validating += KontrolaStrediska_Validating;
Text.Enter += PodbarviFocusRadku_Enter;
Text.Tag = ("S" + Tyden + "_1");
toolTip_CtrlEnter.SetToolTip(Text, "CTRL+Enter = výběr úseku");
DenTable.Controls.Add(Text, 0, 0);
Text = new TextBox();
Text.Dock = DockStyle.Top;
Text.Height = 16;
Text.TextAlign = HorizontalAlignment.Center;
Text.DoubleClick += VyberZakazky_DblClick;
Text.PreviewKeyDown += AllowKeys;
Text.KeyDown += VyberZakazky_CtrlEnter;
Text.KeyDown += ZpracujKlavesy;
Text.Validating += KontrolaZakazky_Validating;
Text.Enter += PodbarviFocusRadku_Enter;
Text.Tag = ("Z" + Tyden + "_1");
toolTip_CtrlEnter.SetToolTip(Text, "CTRL+Enter = výběr zakázky");
DenTable.Controls.Add(Text, 1, 0);
break;
case 3:
Popisek = new Label();
Popisek.Text = "Hodiny";
Popisek.Dock = DockStyle.Top;
Popisek.Height = 16;
Popisek.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
DenTable.Controls.Add(Popisek);
DenTable.SetColumnSpan(Popisek, 9);
break;
case 4:
Tlacitko = new Button();
Tlacitko.Text = "+";
Tlacitko.Width = 24;
Tlacitko.Height = 16;
Tlacitko.TabStop = false;
Tlacitko.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
Tlacitko.Click += PridejRadek_Click;
Tlacitko.Tag = ("B" + Tyden + "_1");
DenTable.Controls.Add(Tlacitko, 0, 0);
break;
default:
break;
}
TydenTable.Controls.Add(DenTable, 0, Radek);
}
Panel TydenPanel = new Panel();
TydenPanel.BorderStyle = BorderStyle.Fixed3D;
TydenPanel.AutoSize = true;
TydenPanel.Controls.Add(TydenTable);
TydenPanel.Tag = Tyden;
Formular.Controls.Add(TydenPanel, 0, Tyden - PrvniTyden);
AktalniTyden = Tyden;
}
DenTydne = (Int32)Kalendar.GetDayOfWeek(Datum);
DenTydne = DenTydne == 0 ? 8 : DenTydne + 1;
Popisek = new Label();
Popisek.Text = Datum.Day.ToString();
Popisek.Dock = DockStyle.Top;
Popisek.Height = 16;
Popisek.Tag = Datum.Day;
Popisek.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
if (!Svatky.EOF())
{
if (Svatky.FieldValues(1) == 1)
Popisek.BackColor = System.Drawing.Color.Cyan;
if (Svatky.FieldValues(2))
Popisek.BackColor = System.Drawing.Color.Red;
Svatky.Next();
}
((TableLayoutPanel)((TableLayoutPanel)((Panel)(Formular.GetControlFromPosition(0, AktalniTyden - PrvniTyden))).Controls[0]).GetControlFromPosition(0, 0)).Controls.Add(Popisek, DenTydne, 0);
Text = new TextBox();
Text.Dock = DockStyle.Top;
Text.Height = 16;
Text.TextAlign = HorizontalAlignment.Center;
toolTip_CtrlEnter = new ToolTip();
Text.DoubleClick += VyberCinnost_DblClick;
Text.PreviewKeyDown += AllowKeys;
Text.KeyDown += VyberCinnost_CtrlEnter;
Text.KeyDown += ZpracujKlavesy;
Text.Enter += PodbarviFocusRadku_Enter;
Text.Validating += KontrolaCinnosti_Validating;
toolTip_CtrlEnter.SetToolTip(Text, "CTRL+Enter = výběr činnosti");
Text.Tag = ("C" + Den + "_1");
((TableLayoutPanel)((TableLayoutPanel)((Panel)(Formular.GetControlFromPosition(0, AktalniTyden - PrvniTyden))).Controls[0]).GetControlFromPosition(0, 2)).Controls.Add(Text, DenTydne, 0);
Text = new TextBox();
Text.Dock = DockStyle.Top;
Text.Height = 16;
Text.TextAlign = HorizontalAlignment.Center;
Text.Tag = ("H" + Den + "_1");
Text.PreviewKeyDown += AllowKeys;
Text.KeyDown += ZpracujKlavesy;
Text.Enter += PodbarviFocusRadku_Enter;
Text.Validating += KontrolaHodin_Validating;
((TableLayoutPanel)((TableLayoutPanel)((Panel)(Formular.GetControlFromPosition(0, AktalniTyden - PrvniTyden))).Controls[0]).GetControlFromPosition(0, 4)).Controls.Add(Text, DenTydne, 0);
}
panel_Formular.Controls.Add(Formular);
FocusTyden = 0;
FocusRadek = 0;
}
示例13: GetPen
protected virtual Pen GetPen(TableLayoutPanel tlP, int column, int row)
{
Control controlFromPosition = tlP.GetControlFromPosition(column, row);
if (controlFromPosition != null)
{
return (controlFromPosition as PopupLineStyleLabel).SelectedPen;
}
return new Pen(SystemColors.Control);
}
示例14: GenerateSQLCommand
string GenerateSQLCommand(TableLayoutPanel targetPanel)
{
string output = string.Empty;
for (int i = 1; i < targetPanel.RowCount - 1; i++) //ignore last row
{
string tittle = ((TextBox)targetPanel.GetControlFromPosition(1, i)).Text;
string amount = ((NumericUpDown)targetPanel.GetControlFromPosition(2, i)).Value.ToString();
output += tittle + "\n" + amount + "\n";
}
return output;
}
示例15: GetColor
protected Color GetColor(TableLayoutPanel tlP, int column, int row)
{
Control controlFromPosition = tlP.GetControlFromPosition(column, row);
if (controlFromPosition != null)
{
return (controlFromPosition as PopupColorLabel).SelectedColor;
}
return SystemColors.Control;
}