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.NativeMethods.ICategorizeProperties GetCategorizeProperties()
 {
     if (((this.iCategorizeProperties == null) && !this.axState[checkedCP]) && (this.instance != null))
     {
         this.axState[checkedCP] = true;
         if (this.instance is System.Windows.Forms.NativeMethods.ICategorizeProperties)
         {
             this.iCategorizeProperties = (System.Windows.Forms.NativeMethods.ICategorizeProperties) this.instance;
         }
     }
     return this.iCategorizeProperties;
 }