本文整理汇总了C#中System.Windows.Forms.TableLayoutPanel.GetColumn方法的典型用法代码示例。如果您正苦于以下问题:C# TableLayoutPanel.GetColumn方法的具体用法?C# TableLayoutPanel.GetColumn怎么用?C# TableLayoutPanel.GetColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.TableLayoutPanel
的用法示例。
在下文中一共展示了TableLayoutPanel.GetColumn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestExtenderMethods
public void TestExtenderMethods ()
{
TableLayoutPanel p = new TableLayoutPanel ();
Control c = new Button ();
Assert.AreEqual (new TableLayoutPanelCellPosition (-1, -1), p.GetCellPosition (c), "A1");
Assert.AreEqual (-1, p.GetColumn (c), "A2");
Assert.AreEqual (1, p.GetColumnSpan (c), "A3");
Assert.AreEqual (-1, p.GetRow (c), "A4");
Assert.AreEqual (1, p.GetRowSpan (c), "A5");
p.SetCellPosition (c, new TableLayoutPanelCellPosition (1, 1));
Assert.AreEqual (new TableLayoutPanelCellPosition (1, 1), p.GetCellPosition (c), "A6");
p.SetColumn (c, 2);
Assert.AreEqual (2, p.GetColumn (c), "A7");
p.SetRow (c, 2);
Assert.AreEqual (2, p.GetRow (c), "A9");
p.SetColumnSpan (c, 2);
Assert.AreEqual (2, p.GetColumnSpan (c), "A8");
p.SetRowSpan (c, 2);
Assert.AreEqual (2, p.GetRowSpan (c), "A10");
Assert.AreEqual (new TableLayoutPanelCellPosition (2, 2), p.GetCellPosition (c), "A11");
// ???????
//Assert.AreEqual (new TableLayoutPanelCellPosition (-1, -1), p.GetPositionFromControl (c), "A12");
//Assert.AreEqual (c, p.GetControlFromPosition(0, 0), "A13");
}
示例2: killedPieces_MouseClick
private void killedPieces_MouseClick(object sender, MouseEventArgs e)
{
if (pawnChangable)
{
Control c = (Control)sender;
TableLayoutPanel teamBox = new TableLayoutPanel();
if (currentState.getMyTeam() == (int)team.black)
teamBox = this.blackTeamPanel;
else if (currentState.getMyTeam() == (int)team.white)
teamBox = this.whiteTeamPanel;
int index = (teamBox.GetRow(c) * 2) + teamBox.GetColumn(c);
if (gameboard.getDead(currentState.getMyTeam()).Count() > index)
{
Piece currentPiece = gameboard.getDead(currentState.getMyTeam())[index];
if (gameboard.tradePawn(previousPiece, currentPiece))
{
if (gameboard.checkChessMate(currentState.getMyTeam()) == (int)moveResult.chessMate)
{
DialogResult result = MessageBox.Show("Chessmate! You win.\n\nPlay again?", "Chess - Message", MessageBoxButtons.YesNo);
promptNewGame(result);
return;
}
pawnChangable = false;
previousPiece = null;
AIOpponent.Move(gameboard, currentState);
updateBoard();
if (gameboard.checkChessMate(currentState.getOpponentTeam()) == (int)moveResult.chessMate)
{
DialogResult result = MessageBox.Show("Chessmate! You loose.\n\nPlay again?", "Chess - Message", MessageBoxButtons.YesNo);
promptNewGame(result);
return;
}
}
}
}
}