Example #1
0
 /// <summary>
 /// Raises the <see cref="E:System.Windows.Forms.Control.HandleDestroyed"/> event.
 /// </summary>
 /// <param name="e">
 /// An <see cref="T:System.EventArgs"/> that contains the event data.
 /// </param>
 protected override void OnHandleDestroyed(EventArgs e)
 {
     if (DesignMode == false)
     {
         if (_RenderContext != IntPtr.Zero)
         {
             // Event handling
             OnContextDestroying();
             // Destroy context
             DeleteContext();
         }
         // Destroy device context
         _DeviceContext.DecRef();
         _DeviceContext = null;
     }
     // Base implementation
     base.OnHandleDestroyed(e);
 }