private void ReleaseAxControl() { this.NoComponentChangeEvents++; ContainerControl containingControl = this.ContainingControl; if (containingControl != null) { containingControl.VisibleChanged -= this.onContainerVisibleChanged; } try { if (this.instance != null) { Marshal.FinalReleaseComObject(this.instance); this.instance = null; this.iOleInPlaceObject = null; this.iOleObject = null; this.iOleControl = null; this.iOleInPlaceActiveObject = null; this.iOleInPlaceActiveObjectExternal = null; this.iPerPropertyBrowsing = null; this.iCategorizeProperties = null; this.iPersistStream = null; this.iPersistStreamInit = null; this.iPersistStorage = null; } this.axState[checkedIppb] = false; this.axState[checkedCP] = false; this.axState[disposed] = true; this.freezeCount = 0; this.axState[sinkAttached] = false; this.wndprocAddr = IntPtr.Zero; this.SetOcState(0); } finally { this.NoComponentChangeEvents--; } }
private System.Windows.Forms.UnsafeNativeMethods.IOleObject GetOleObject() { if (this.iOleObject == null) { this.iOleObject = (System.Windows.Forms.UnsafeNativeMethods.IOleObject) this.instance; } return this.iOleObject; }