本文整理汇总了C#中System.Windows.Forms.Button.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Button.Equals方法的具体用法?C# Button.Equals怎么用?C# Button.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Button
的用法示例。
在下文中一共展示了Button.Equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VerificaBlobBotao
public void VerificaBlobBotao(Button b, Point p, int fID)
{
Rectangle re = new Rectangle(b.Left, b.Top, b.Width, b.Height);
if (re.Contains(p))
{
// Verificaçao especial para o botão bntMove-> Colocar no movo de movimentação do
// do teclado
if (b.Equals(bntMove))
{
modoMoveBlob = true;
modoMove = true;
b.Tag = aPictures[fID];
aPictures[fID].Tag = b;
b.BackColor = Color.Gray;
// Desabilitando o teclado e as suas notas!
this.groupTeclado.Enabled = false;
foreach (Button bot in aButtonBlack)
bot.Enabled = true;
foreach (Button bot in aButtonWhite )
bot.Enabled = true;
}
aPictures[fID].Tag = b;
b.BackColor = Color.Gray;
}
else
{
if (aPictures[fID].Tag != null)
{
if (aPictures[fID].Tag.Equals(b))
{
if (!b.Equals(bntMove))
{
aPictures[fID].Tag = null;
b.BackColor = System.Drawing.SystemColors.Control;
}
}
}
}
}
示例2: collides
//Copy and paste the collides method from previous work
//Make changes so that it detects button collisions
public List<Button> collides(Button button)
{
if (collision == true)
{
//int collisionCount = objectCollided.Count;
while (objectCollided.Count > 0)
{
//Empty out objectCollided list first
//for (int i = 0; i < objectCollided.Count; i++)
//{
objectCollided.RemoveRange(0,objectCollided.Count);
//}
}
//Console.WriteLine(objectCollided.Count);
}
//List<Button> colButton = new List<Button>();
//objectCollided = null;
//If the button tested is tank 1
if (button == collectionOfButtons[0])
{
//Calculate the top1, bottom1, right1, and left1 of tank1
calculateAltTankDimensions(0);
//Check to see if tank 1 collides with anything
collisionDetection(1, 2, 3, 4, 5, 6, 7, 9, button);
}
//collectionOfButtons[1].Name = "tank 2";
//If button tested is tank 2
if (button.Equals(collectionOfButtons[1]))
{
//Calculate the top1, buttom1, right1, and left1 of tank 2
calculateAltTankDimensions(1);
//Check to see if tank 2 collides with anything
collisionDetection(0, 2, 3, 4, 5, 6, 7, 8, button);
}
if (collectionOfTanks[0].CanFire == false)
{
//If button tested is bullet 1
if (button == collectionOfButtons[8])
{
//Calculate the top1, bottom1, right1, and left1 of bullet 1
calculateAltBulletDimensions(8);
//Check to see if bullet 1 collides with anything
collisionDetection(1, 2, 3, 4, 5, 6, 7, 9, button);
}
}
//If button tested is bullet 2
if (button == collectionOfButtons[9])
{
//Calculate the top1, botom1, right1, and left1 of bullet 2
calculateAltBulletDimensions(9);
//Check to see if bullet 2 collides with anything
collisionDetection(0, 2, 3, 4, 5, 6, 7, 8, button);
}
//Reset button
//button = null;
//Return the list of objects collided with each other
return objectCollided;
}