Пример #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>
        /// ------------------------------------------------------------------------------------
        //[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);
        }
Пример #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>
        /// ------------------------------------------------------------------------------------
        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);
        }
Пример #3
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)
        {
            if (disposing)
            {
                if (m_textBoxControl != null)
                {
                    m_textBoxControl.Dispose();
                }
                if (m_collatingEngine != null)
                {
                    m_collatingEngine.Close();
                }
                if (m_fontCache != null && m_fontCache.Count > 0)
                {
                    foreach (Font fnt in m_fontCache.Values)
                    {
                        fnt.Dispose();
                    }

                    m_fontCache.Clear();
                }
            }

            m_textBoxControl  = null;
            m_cache           = null;
            m_collatingEngine = null;
            m_fontCache       = null;
            base.Dispose(disposing);
        }
Пример #4
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Attaches and initializes the hosted editing control.
        /// </summary>
        /// <param name="rowIndex">The index of the row being edited.</param>
        /// <param name="initialFormattedValue">The initial value to be displayed in the
        /// control.</param>
        /// <param name="dataGridViewCellStyle">A cell style that is used to determine the
        /// appearance of the hosted control.</param>
        /// <PermissionSet>
        ///		<IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true"/>
        ///		<IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true"/>
        ///		<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence"/>
        ///		<IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true"/>
        /// </PermissionSet>
        /// ------------------------------------------------------------------------------------
        public override void InitializeEditingControl(int rowIndex, object initialFormattedValue,
                                                      DataGridViewCellStyle dataGridViewCellStyle)
        {
            base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle);
            FwTextBoxControl ctrl = DataGridView.EditingControl as FwTextBoxControl;

            InitializeTextBoxControl(ctrl, rowIndex);
        }
Пример #5
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes the text box control.
		/// </summary>
		/// <param name="ctrl">The FwTextBox control to initialize.</param>
		/// <param name="rowIndex">The row index.</param>
		/// <remarks><paramref name="rowIndex"/> is usually the same as RowIndex, except in the
		/// case of a shared row (in which case RowIndex is always -1).</remarks>
		/// ------------------------------------------------------------------------------------
		private void InitializeTextBoxControl(FwTextBoxControl ctrl, int rowIndex)
		{
			if (rowIndex < 0)
				return;

			// The owning column owns the FwTextBoxControl we need
			// to edit the cell. So let it do the intialization.
			FwTextBoxColumn col = OwningColumn as FwTextBoxColumn;
			if (col != null)
				col.InitializeTextBoxControl(ctrl, GetValue(rowIndex) as ITsString, rowIndex);
		}
Пример #6
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Attaches and initializes the hosted editing control.
        /// </summary>
        /// <param name="rowIndex">The index of the row being edited.</param>
        /// <param name="initialFormattedValue">The initial value to be displayed in the
        /// control.</param>
        /// <param name="dataGridViewCellStyle">A cell style that is used to determine the
        /// appearance of the hosted control.</param>
        /// <PermissionSet>
        ///		<IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true"/>
        ///		<IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true"/>
        ///		<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence"/>
        ///		<IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true"/>
        /// </PermissionSet>
        /// ------------------------------------------------------------------------------------
        public override void InitializeEditingControl(int rowIndex, object initialFormattedValue,
                                                      DataGridViewCellStyle dataGridViewCellStyle)
        {
#if !__MonoCS__
            // FWNX-472 on mono calling base.InitalizeEditingControl reverts DataGridView.EditingControl
            // to a DataGridViewTextBoxEditingControl.
            base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle);
#endif
            FwTextBoxControl ctrl = DataGridView.EditingControl as FwTextBoxControl;
            InitializeTextBoxControl(ctrl, rowIndex);
        }
Пример #7
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes the text box control.
        /// </summary>
        /// <param name="ctrl">The FwTextBox control to initialize.</param>
        /// <param name="rowIndex">The row index.</param>
        /// <remarks><paramref name="rowIndex"/> is usually the same as RowIndex, except in the
        /// case of a shared row (in which case RowIndex is always -1).</remarks>
        /// ------------------------------------------------------------------------------------
        private void InitializeTextBoxControl(FwTextBoxControl ctrl, int rowIndex)
        {
            if (rowIndex < 0)
            {
                return;
            }

            // The owning column owns the FwTextBoxControl we need
            // to edit the cell. So let it do the intialization.
            FwTextBoxColumn col = OwningColumn as FwTextBoxColumn;

            if (col != null)
            {
                col.InitializeTextBoxControl(ctrl, GetValue(rowIndex) as ITsString, rowIndex);
            }
        }
Пример #8
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();
				}
			}

			m_textBoxControl = null;
			m_cache = null;
			m_fontCache = null;
			base.Dispose(disposing);
		}
Пример #9
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)
		{
			if (disposing)
			{
				if (m_textBoxControl != null)
					m_textBoxControl.Dispose();
				if (m_collatingEngine != null)
					m_collatingEngine.Close();
				if (m_fontCache != null && m_fontCache.Count > 0)
				{
					foreach (Font fnt in m_fontCache.Values)
						fnt.Dispose();

					m_fontCache.Clear();
				}
			}

			m_textBoxControl = null;
			m_cache = null;
			m_collatingEngine = null;
			m_fontCache = null;
			base.Dispose(disposing);
		}