本文整理汇总了C#中System.Windows.Forms.Control.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# Control.ContainsKey方法的具体用法?C# Control.ContainsKey怎么用?C# Control.ContainsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Control
的用法示例。
在下文中一共展示了Control.ContainsKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateBoardState
public void UpdateBoardState(Byte startSquare, Byte endSquare, Control.ControlCollection formControls)
{
var playerColorNum = board[startSquare];
var jumpedSquare = engine.GetJumpedSquare(startSquare, endSquare);
var panelName = "sq" + jumpedSquare;
// move the piece
board[endSquare] = board[startSquare];
board[startSquare] = 0;
// remove jumped piece
if (jumpedSquare != 0)
{
board[jumpedSquare] = 0;
if (formControls.ContainsKey(panelName))
formControls[panelName].BackgroundImage = null;
}
// handle kinging
if (endSquare < 8 && board[endSquare] == 1)
{
board[endSquare] = 3;
formControls["sq" + endSquare].BackgroundImage = whiteKing;
}
else if (endSquare > 55 && board[endSquare] == 2)
{
board[endSquare] = 4;
formControls["sq" + endSquare].BackgroundImage = redKing;
}
}
示例2: RemoveControlFrom
private void RemoveControlFrom(Control.ControlCollection controls, string controlname)
{
if (controls.ContainsKey(controlname)) controls.RemoveByKey(controlname);
//foreach (Control control in controls)
//{
// if (control.Name.ToLower() == controlname.ToLower())
// {
// controls.Remove(control); controls.Owner.Update();
// }
//}
}