/// <summary> /// Release the handle /// </summary> /// <returns>true if handled is release successfully, false otherwise</returns> protected override bool ReleaseHandle() { if (CoreNativeMethods.DestroyIcon(handle)) { return(true); } else { return(false); } }
/// <summary> /// Release the native and managed objects /// </summary> /// <param name="disposing">Indicates that this is being called from Dispose(), rather than the finalizer.</param> protected virtual void Dispose(bool disposing) { if (disposing) { // dispose managed resources here } // Unmanaged resources if (hIcon != IntPtr.Zero) { CoreNativeMethods.DestroyIcon(hIcon); } }
private void UpdateHIcon() { if (invalidateIcon) { if (hIcon != IntPtr.Zero) { CoreNativeMethods.DestroyIcon(hIcon); } hIcon = GetHIcon(); invalidateIcon = false; } }