New answers tagged

2

Here is some boiler plate code to set up active view events. You'll just need to write a function that checks if the item added is a shapefile. Call that function from Events_ItemAdded(). public static IActiveViewEvents_Event ActiveViewEvent; private void WireDocumentEvents() { // Event handlers ArcMap.Events.CloseDocument +=...


3

The event handler for capturing layers added to the map is IActiveViewEvents.ItemAdded Make sure its pointing to a Map and not PageLayout. You would then test to see if it is specifically a shapefile.


0

I found the issue. The main thread for the test project I had set up for this functionality was an MTA (Multi Threaded Apartment) thread. Simply calling everything from an STA (Single Threaded Apartment) thread caused the issue to go away. Thread t = new Thread(x => ...) //call projection code here t.SetApartmentState(ApartmentState.STA); t....


2

This is from working code, in this example 'timer save' a window pops up when a time has elapsed reminding the user to save, so I only use OnStartEditing and OnStopEditing events; It is important to note that this occurs in the form load event as there is an attached form: private void TimerSaveForm_Load(object sender, EventArgs e) { vSaveEditsWarn = ...


0

with the same code, I just made changes in this line and it worked IPoint pnewPnt = new PointClass(); pnewPnt.X = pPnt.X -300; pnewPnt.Y = pPnt.Y;


Top 50 recent answers are included