コード例 #1
0
 public void OnNewColour(ColourEventArgs colourArgs)
 {
     // Note the copy to a local variable, so that we don't risk a
     // NullReferenceException if another thread unsubscribes between the test and
     // the invocation.
     ColourEventHandler handler = NewColour;
     if (handler != null)
     {
         handler(this, colourArgs);
     }
 }
コード例 #2
0
 private void UpdateColour(Color colour)
 {
     this.SelectedColour = colour;
     ColourEventArgs args = new ColourEventArgs(colour);
     OnNewColour(args);
     this.Refresh();
 }