Handling Events
Because all events in the MapForce library are based on connection points, you can use the C# delegate mechanism to provide the custom event handlers. You will always find a complete list of events on the property page of each control of the MapForce library. The image below shows the events of the main MapForceControl:
As you can see, the example project only overrides the OnFileExternalChange event. The creation of the C# delegate is done for you by the C# Framework. All you need to do is fill in the empty event handler.
For example, the handler implementation shown below turns off any file reloading and displays a message box to inform the user that a file loaded by the MapForceControl has been changed from outside:
private void axMapForceControl_OnFileExternalChange(object sender, AxMapForceControlLib._DMapForceControlEvents_OnFileExternalChangeEvent e) { MessageBox.Show("Attention: The file " + e.strPath + " has been changed from outside\but reloading is turned off in the sample application!");
// This turns off any file reloading: e.varRet = false; } |