コード例 #1
0
        // IDisposable
        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposedValue & disposing)
            {
                if (disposing)
                {
                    // TODO: dispose managed state (managed objects).

                    if (clientTextBox != null)
                    {
                        this.ReleaseHandle();

                        clientTextBox.Invalidate();

                        clientTextBox.HandleCreated     -= TextBoxBase_HandleCreated;
                        clientTextBox.ClientSizeChanged -= TextBoxBase_ClientSizeChanged;

                        clientTextBox.Dispose();
                        clientTextBox = null;
                    }

                    if (myBitmap != null)
                    {
                        myBitmap.Dispose();
                        myBitmap = null;
                    }

                    if (textBoxGraphics != null)
                    {
                        textBoxGraphics.Dispose();
                        textBoxGraphics = null;
                    }

                    if (bufferGraphics != null)
                    {
                        bufferGraphics.Dispose();
                        bufferGraphics = null;
                    }

                    if (mySpeller != null)
                    {
                        mySpeller = null;
                    }
                }

                // TODO: free unmanaged resources (unmanaged objects) and override Finalize() below.
                // TODO: set large fields to null.
            }
            this.disposedValue = true;
        }