//sets subject, button, random object public Observer(SubjectWithEvent subject, String observerName, Button buttonToClick, Random random) { this.subject = subject; this.observerName = observerName; this.random = random; buttonString = buttonToClick.ToString(); //adds delegate instance containing "DoStuff" to the buttons click event buttonToClick.Click += new System.EventHandler(DoStuff); }
private Square buttonSquare(Button button) { foreach (Square square in Squares.All) { if (button == this[square]) return square; } // semi-colon not needed throw new ApplicationException("invalid button " + button.ToString()); //MessageBox.Show(String.Format("invalid button {0}", button)); }
public void ToStringTest () { Button B1 = new Button (); Assert.AreEqual ("System.Windows.Forms.Button, Text: " , B1.ToString (), "#9"); }
public override string ToString() { return(string.Format( "TreeNodeMouseClickEventArgs\r\n\tNode: {0}\r\n\tButton: {1}\r\n\tX: {2}\r\n\tY: {3}", nodeValue.Text, Button.ToString(), X, Y)); }