// Called when this object is going to destroy it's Win32 handle. You // may override this if there is something special you need to do to // destroy the handle. This will be called even if the handle is not // owned by this object, which is handy if you want to create a // derived class that has it's own create/destroy semantics. // // The default implementation will call the appropriate Win32 // call to destroy the handle if this object currently owns the // handle. It will do nothing if the object does not currently // own the handle. internal void DestroyHandle() { if (_ownHandle) { SafeNativeMethods.DestroyIcon(new HandleRef(this, _handle)); _handle = IntPtr.Zero; } }