Пример #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">set to <c>true</c> if called from the Dispose() method,
        /// set to <c>false</c> if called by GC. If this parameter is <c>false</c> we shouldn't
        /// access any managed objects since these might already have been destroyed.</param>
        /// ------------------------------------------------------------------------------------
        protected override void Dispose(bool disposing)
        {
            // Debug.WriteLineIf statement disabled because of a bug in .NET DataGridView:
            // DataGridView.AddRange() creates a temporary clone that it doesn't dispose, so we
            // will always get this warning message and we can't do anything about it.
            // Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** ");
            if (disposing)
            {
                if (m_textBoxControl != null)
                {
                    m_textBoxControl.Dispose();
                }
                if (m_fontCache != null)
                {
                    foreach (Font fnt in m_fontCache.Values)
                    {
                        fnt.Dispose();
                    }

                    m_fontCache.Clear();
                }
                if (m_DisposeCellTemplate && CellTemplate != null)
                {
                    CellTemplate.Dispose();
                    CellTemplate          = null;
                    m_DisposeCellTemplate = false;
                }
            }

            m_textBoxControl = null;
            m_cache          = null;
            m_fontCache      = null;
            base.Dispose(disposing);
        }
Пример #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">set to <c>true</c> if called from the Dispose() method,
        /// set to <c>false</c> if called by GC. If this parameter is <c>false</c> we shouldn't
        /// access any managed objects since these might already have been destroyed.</param>
        /// ------------------------------------------------------------------------------------
        //[SuppressMessage("Clouseau", "MissingDisposeCall", Justification = "Debug.WriteLineIf statement disabled because of a bug in .NET DataGridView:"
        //	+ "DataGridView.AddRange() creates a temporary clone that it doesn't dispose, so we will always get this warning message and we can't do anything about it.")]
        protected override void Dispose(bool disposing)
        {
            Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** (but this might not be your fault)");
            if (disposing)
            {
                if (m_textBoxControl != null)
                {
                    m_textBoxControl.Dispose();
                }
                if (m_fontCache != null)
                {
                    foreach (Font fnt in m_fontCache.Values)
                    {
                        fnt.Dispose();
                    }

                    m_fontCache.Clear();
                }
                if (m_DisposeCellTemplate && CellTemplate != null)
                {
                    CellTemplate.Dispose();
                    CellTemplate          = null;
                    m_DisposeCellTemplate = false;
                }
            }

            m_textBoxControl = null;
            m_cache          = null;
            m_fontCache      = null;
            base.Dispose(disposing);
        }
        /// <summary>
        /// Dispose the object
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType() + ". ****** ");
            base.Dispose(disposing);

            if (disposing)
            {
                if (CellTemplate != null)
                {
                    CellTemplate.Dispose();
                }
                CellTemplate = null;
            }
        }