context: using System;
  using System.ComponentModel;
  using System.Drawing;
  using System.Windows.Forms;
  using System.Diagnostics.CodeAnalysis;
  
  namespace WeifenLuo.WinFormsUI.Docking
  {
      public class DockContent : Form, IDockContent
      {
          public DockContent()
          {
              m_dockHandler = new DockContentHandler(this, new GetPersistStringCallback(GetPersistString));
              m_dockHandler.DockStateChanged += new EventHandler(DockHandler_DockStateChanged);
              if (PatchController.EnableFontInheritanceFix != true)
              {
                  //Suggested as a fix by bensty regarding form resize
                  this.ParentChanged += new EventHandler(DockContent_ParentChanged);
              }
          }
  
          //Suggested as a fix by bensty regarding form resize
          private void DockContent_ParentChanged(object Sender, EventArgs e)
          {
              if (this.Parent != null)
                  this.Font = this.Parent.Font;
          }
  
          private DockContentHandler m_dockHandler = null;
          [Browsable(false)]
          public DockContentHandler DockHandler
          {
              get { return m_dockHandler; }
          }
  
          [LocalizedCategory("Category_Docking")]
          [LocalizedDescription("DockContent_AllowEndUserDocking_Description")]
          [DefaultValue(true)]
          public bool AllowEndUserDocking
          {
              get { return DockHandler.AllowEndUserDocking; }
              set { DockHandler.AllowEndUserDocking = value; }
          }
  
          [LocalizedCategory("Category_Docking")]
          [LocalizedDescription("DockContent_DockAreas_Description")]
          [DefaultValue(DockAreas.DockLeft | DockAreas.DockRight | DockAreas.DockTop | DockAreas.DockBottom | DockAreas.Document | DockAreas.Float)]
          public DockAreas DockAreas
          {
              get { return DockHandler.DockAreas; }
              set { DockHandler.DockAreas = value; }
          }
  
          [LocalizedCategory("Category_Docking")]
          [LocalizedDescription("DockContent_AutoHidePortion_Description")]
          [DefaultValue(0.25)]
          public double AutoHidePortion
          {
              get { return DockHandler.AutoHidePortion; }
              set { DockHandler.AutoHidePortion = value; }
          }
  
          private string m_tabText = null;
          [Localizable(true)]
          [LocalizedCategory("Category_Docking")]
          [LocalizedDescription("DockContent_TabText_Description")]
          [DefaultValue(null)]
          public string TabText
          {
              get { return m_tabText; }
              set { DockHandler.TabText = m_tabText = value; }
          }
  
          private bool ShouldSerializeTabText()
          {
              return (m_tabText != null);
          }
  
          [LocalizedCategory("Category_Docking")]
          [LocalizedDescription("DockContent_CloseButton_Description")]
          [DefaultValue(true)]
          public bool CloseButton
          {
              get { return DockHandler.CloseButton; }
              set { DockHandler.CloseButton = value; }
          }
  
          [LocalizedCategory("Category_Docking")]
          [LocalizedDescription("DockContent_CloseButtonVisible_Description")]
          [DefaultValue(true)]
          public bool CloseButtonVisible
          {
              get { return DockHandler.CloseButtonVisible; }
              set { DockHandler.CloseButtonVisible = value; }
          }
  
          [Browsable(false)]
          [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
          public DockPanel DockPanel
          {
              get { return DockHandler.DockPanel; }
              set { DockHandler.DockPanel = value; }
          }
  
          [Browsable(false)]
          [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
          public DockState DockState
          {
              get { return DockHandler.DockState; }
              set { DockHandler.DockState = value; }
          }
  
          [Browsable(false)]
          [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
          public DockPane Pane
          {
              get { return DockHandler.Pane; }
              set { DockHandler.Pane = value; }
          }
  
          [Browsable(false)]
          [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
          public bool IsHidden
          {
              get { return DockHandler.IsHidden; }
              set { DockHandler.IsHidden = value; }
          }
  
          [Browsable(false)]
          [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
          public DockState VisibleState
          {
              get { return DockHandler.VisibleState; }
              set { DockHandler.VisibleState = value; }
          }
  
          [Browsable(false)]
          [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
          public bool IsFloat
          {
              get { return DockHandler.IsFloat; }
              set { DockHandler.IsFloat = value; }
          }
  
          [Browsable(false)]
          [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
          public DockPane PanelPane
          {
              get { return DockHandler.PanelPane; }
              set { DockHandler.PanelPane = value; }
          }
  
          [Browsable(false)]
          [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
          public DockPane FloatPane
          {
              get { return DockHandler.FloatPane; }
              set { DockHandler.FloatPane = value; }
          }
  
          [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
          protected virtual string GetPersistString()
          {
              return GetType().ToString();
          }
  
          [LocalizedCategory("Category_Docking")]
          [LocalizedDescription("DockContent_HideOnClose_Description")]
          [DefaultValue(false)]
          public bool HideOnClose
          {
              get { return DockHandler.HideOnClose; }
              set { DockHandler.HideOnClose = value; }
          }
  
          [LocalizedCategory("Category_Docking")]
          [LocalizedDescription("DockContent_ShowHint_Description")]
          [DefaultValue(DockState.Unknown)]
          public DockState ShowHint
          {
              get { return DockHandler.ShowHint; }
              set { DockHandler.ShowHint = value; }
          }
  
          [Browsable(false)]
          public bool IsActivated
          {
              get { return DockHandler.IsActivated; }
          }
  
          public bool IsDockStateValid(DockState dockState)
          {
              return DockHandler.IsDockStateValid(dockState);
          }
  
          /// <summary>
          /// Context menu.
          /// </summary>
          /// <remarks>
          /// This property should be obsolete as it does not support theming. Please use <see cref="TabPageContextMenuStrip"/> instead.
          /// </remarks>
          [LocalizedCategory("Category_Docking")]
          [LocalizedDescription("DockContent_TabPageContextMenu_Description")]
          [DefaultValue(null)]
          public ContextMenu TabPageContextMenu
          {
              get { return DockHandler.TabPageContextMenu; }
              set { DockHandler.TabPageContextMenu = value; }
          }
  
          /// <summary>
          /// Context menu strip.
          /// </summary>
          [LocalizedCategory("Category_Docking")]
          [LocalizedDescription("DockContent_TabPageContextMenuStrip_Description")]
          [DefaultValue(null)]
          public ContextMenuStrip TabPageContextMenuStrip
          {
              get { return DockHandler.TabPageContextMenuStrip; }
              set { DockHandler.TabPageContextMenuStrip = value; }
          }
  
          public void ApplyTheme()
          {
              DockHandler.ApplyTheme();
  
  
gt:             if (DockPanel != null)