Adding Event Handler - Delete Graphic Element

559
2
09-04-2013 05:26 PM
deleted-user-VeC5jUIlNXtq
Occasional Contributor III
Hey all,

I've got a quick question regarding event handlers. I have a program to lock and unlock graphic elements in the page layout (text, etc...).

The issue is that "locked" (IElement.Locked = True) elements, can still be deleted, which I would like to prevent.

I have the code to prevent the delete, however I don't know how to add the actual event handler so that when I try to delete a locked element, it catches it and prevents it.

I guess this event handler should work independently of the actual lock/unlock Add-In, however I'm lost at where to begin.

Any assistance would be greatly appreciated (I'm a bit of an amateur at all of this so more detail is better).

Thanks, and let me know if more information is required for this.
0 Kudos
2 Replies
NeilClemmons
Regular Contributor III
The IGraphicsContainerEvents interface has the event you're looking for.  You may not be able to prevent the actual delete from taking place but you can probably just add the element back.
0 Kudos
deleted-user-VeC5jUIlNXtq
Occasional Contributor III
Thanks Neil,

I'll look at implementing this. Related question: do you know of any current issues with IElement.Locked?

I know that many years ago there was a bug associated with it, but I have no details (other than an old bug number which I'm unable to find any info on). I was curious if you (or anyone else) know of anything currently wrong with this property.

Thanks again!
0 Kudos