# C1.Framework.ControlHostElement

## Content

<div class="doc-site-dotnet-api-container">



  <h1 id="C1_Framework_ControlHostElement" data-uid="C1.Framework.ControlHostElement" class="text-break">ControlHostElement Class
</h1>
  <div class="markdown level0 summary"><p><a class="xref" href="C1.Framework.Element.html">Element</a> that hosts a WinForms <a class="xref" href="C1.Framework.ControlHostElement.Control.html#C1_Framework_ControlHostElement_Control">Control</a>.</p>
</div>
  <div class="markdown level0 conceptual"></div>
  <div class="inheritance">
    <h5>Inheritance</h5>
    <div class="level0"><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
    <div class="level1"><a class="xref" href="C1.Framework.Element.html">Element</a></div>
    <div class="level2"><span class="xref">ControlHostElement</span></div>
      <div class="level3"><a class="xref" href="C1.Framework.TextBoxElement.html">TextBoxElement</a></div>
  </div>
  <div class="implements">
    <h5>Implements</h5>
    <div><a class="xref" href="C1.Win.Accessibility.ISupportUia.html">ISupportUia</a></div>
    <div><a class="xref" href="C1.Framework.IControlHostElement.html">IControlHostElement</a></div>
  </div>
  <h6><strong>Namespace</strong>: <a class="xref" href="C1.Framework.html">C1.Framework</a></h6>
  <h6><strong>Assembly</strong>: C1.Win.10.dll</h6>
  <h5 id="C1_Framework_ControlHostElement_syntax">Syntax</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public class ControlHostElement : Element, ISupportUia, IControlHostElement</code></pre>
  </div>
  <div class="codewrapper">
    <pre><code class="lang-vbnet hljs">Public Class ControlHostElement
    Inherits Element
    Implements ISupportUia, IControlHostElement</code></pre>
  </div>
  <h5 id="C1_Framework_ControlHostElement_remarks"><strong>Remarks</strong></h5>
  <div class="markdown level0 remarks"><p>In principle, this class allows hosting <i>any</i> WinForms control. In practice,
not all controls work well in this scenario. For example, some controls cannot be freely
resized, so the element should account for that.</p>
<p>** Important Note: to allow hosting generic controls, this class stores a reference
to itself in the contained control's <b>Tag</b> property. That means hosted controls cannot 
use their <b>Tag</b> property for anything else.</p>
</div>
  <h3 id="constructors">Constructors
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="C1_Framework_ControlHostElement__ctor" data-uid="C1.Framework.ControlHostElement.#ctor">
          <a class="xref" href="C1.Framework.ControlHostElement.-ctor.html#C1_Framework_ControlHostElement__ctor">ControlHostElement()</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="C1.Framework.ControlHostElement.html">ControlHostElement</a>.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Framework_ControlHostElement__ctor_C1_Framework_Style_" data-uid="C1.Framework.ControlHostElement.#ctor(C1.Framework.Style)">
          <a class="xref" href="C1.Framework.ControlHostElement.-ctor.html#C1_Framework_ControlHostElement__ctor_C1_Framework_Style_">ControlHostElement(Style)</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="C1.Framework.ControlHostElement.html">ControlHostElement</a> with the specified style.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Framework_ControlHostElement__ctor_C1_Framework_Style_System_Windows_Forms_Control_" data-uid="C1.Framework.ControlHostElement.#ctor(C1.Framework.Style,System.Windows.Forms.Control)">
          <a class="xref" href="C1.Framework.ControlHostElement.-ctor.html#C1_Framework_ControlHostElement__ctor_C1_Framework_Style_System_Windows_Forms_Control_">ControlHostElement(Style, Control)</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="C1.Framework.ControlHostElement.html">ControlHostElement</a> with the specified style and control to host.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Framework_ControlHostElement__ctor_System_Windows_Forms_Control_" data-uid="C1.Framework.ControlHostElement.#ctor(System.Windows.Forms.Control)">
          <a class="xref" href="C1.Framework.ControlHostElement.-ctor.html#C1_Framework_ControlHostElement__ctor_System_Windows_Forms_Control_">ControlHostElement(Control)</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="C1.Framework.ControlHostElement.html">ControlHostElement</a> with the specified control to host.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="properties">Properties
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="C1_Framework_ControlHostElement_Control" data-uid="C1.Framework.ControlHostElement.Control">
          <a class="xref" href="C1.Framework.ControlHostElement.Control.html#C1_Framework_ControlHostElement_Control">Control</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets the <a class="xref" href="C1.Framework.ControlHostElement.Control.html#C1_Framework_ControlHostElement_Control">Control</a> that this element is hosting.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Framework_ControlHostElement_HostPanel" data-uid="C1.Framework.ControlHostElement.HostPanel">
          <a class="xref" href="C1.Framework.ControlHostElement.HostPanel.html#C1_Framework_ControlHostElement_HostPanel">HostPanel</a>
        </td>
        <td class="markdown level1 summary"><p>If overriden in nested classes and returns not null,
InputPanel will use the HostPanel to make <a class="xref" href="C1.Framework.ControlHostElement.Control.html#C1_Framework_ControlHostElement_Control">Control</a> scrollable withing the element.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Framework_ControlHostElement_HostedControl" data-uid="C1.Framework.ControlHostElement.HostedControl">
          <a class="xref" href="C1.Framework.ControlHostElement.HostedControl.html#C1_Framework_ControlHostElement_HostedControl">HostedControl</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the <a class="xref" href="C1.Framework.ControlHostElement.Control.html#C1_Framework_ControlHostElement_Control">Control</a> that is hosted in this element.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="methods">Methods
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="C1_Framework_ControlHostElement_ApplyStyle" data-uid="C1.Framework.ControlHostElement.ApplyStyle">
          <a class="xref" href="C1.Framework.ControlHostElement.ApplyStyle.html#C1_Framework_ControlHostElement_ApplyStyle">ApplyStyle()</a>
        </td>
        <td class="markdown level1 summary"><p>Copies style attributes from the element to the hosted control.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Framework_ControlHostElement_OnGotFocus_System_EventArgs_" data-uid="C1.Framework.ControlHostElement.OnGotFocus(System.EventArgs)">
          <a class="xref" href="C1.Framework.ControlHostElement.OnGotFocus.html#C1_Framework_ControlHostElement_OnGotFocus_System_EventArgs_">OnGotFocus(EventArgs)</a>
        </td>
        <td class="markdown level1 summary"><p>Called by the host control when this <a class="xref" href="C1.Framework.Element.html">Element</a> receives the focus.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Framework_ControlHostElement_OnLostFocus_System_EventArgs_" data-uid="C1.Framework.ControlHostElement.OnLostFocus(System.EventArgs)">
          <a class="xref" href="C1.Framework.ControlHostElement.OnLostFocus.html#C1_Framework_ControlHostElement_OnLostFocus_System_EventArgs_">OnLostFocus(EventArgs)</a>
        </td>
        <td class="markdown level1 summary"><p>Called by the host control when this <a class="xref" href="C1.Framework.Element.html">Element</a> loses the focus.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Framework_ControlHostElement_OnMouseLeave_System_EventArgs_" data-uid="C1.Framework.ControlHostElement.OnMouseLeave(System.EventArgs)">
          <a class="xref" href="C1.Framework.ControlHostElement.OnMouseLeave.html#C1_Framework_ControlHostElement_OnMouseLeave_System_EventArgs_">OnMouseLeave(EventArgs)</a>
        </td>
        <td class="markdown level1 summary"><p>Called by the host control when the mouse leaves this <a class="xref" href="C1.Framework.Element.html">Element</a>.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Framework_ControlHostElement_OnTextChanged_System_EventArgs_" data-uid="C1.Framework.ControlHostElement.OnTextChanged(System.EventArgs)">
          <a class="xref" href="C1.Framework.ControlHostElement.OnTextChanged.html#C1_Framework_ControlHostElement_OnTextChanged_System_EventArgs_">OnTextChanged(EventArgs)</a>
        </td>
        <td class="markdown level1 summary"><p>Override to get text change notifications.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Framework_ControlHostElement_Render_System_Drawing_Graphics_System_Drawing_Rectangle_" data-uid="C1.Framework.ControlHostElement.Render(System.Drawing.Graphics,System.Drawing.Rectangle)">
          <a class="xref" href="C1.Framework.ControlHostElement.Render.html#C1_Framework_ControlHostElement_Render_System_Drawing_Graphics_System_Drawing_Rectangle_">Render(Graphics, Rectangle)</a>
        </td>
        <td class="markdown level1 summary"><p>Renders the element into a given rectangle.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Framework_ControlHostElement_UpdateControlBounds" data-uid="C1.Framework.ControlHostElement.UpdateControlBounds">
          <a class="xref" href="C1.Framework.ControlHostElement.UpdateControlBounds.html#C1_Framework_ControlHostElement_UpdateControlBounds">UpdateControlBounds()</a>
        </td>
        <td class="markdown level1 summary"><p>Updates the hosted control bounds to match the element's bounds.</p>
</td>
      </tr>
    </tbody>
  </table>

</div>
