.. default-domain:: cs .. highlight:: csharp .. namespace:: KRPC.Client.Services.UI Panel ===== .. class:: Panel A container for user interface elements. Added to a :type:`Canvas` or another panel. | Base class: :type:`Container` .. container:: inherited-members .. rubric:: Inherited Members * From :type:`Container`: :meth:`AddPanel `, :meth:`AddText `, :meth:`AddInputField `, :meth:`AddButton `, :meth:`AddToggle `, :meth:`AddToggleGroup `, :meth:`AddSlider `, :meth:`AddDropdown `, :meth:`AddImage `, :meth:`AddScrollView ` * From :type:`Object`: :prop:`RectTransform `, :prop:`LayoutElement `, :prop:`Visible `, :meth:`Remove ` .. property:: PanelStyle Style { get; set; } How the background of the panel is drawn. A box is the frame to group related controls in, and is how a group box is made. :Game Scenes: All .. property:: StdLib.ColorRGBA Color { get; set; } The color the background of the panel is tinted with. :Game Scenes: All .. note:: Has no effect while the style of the panel is :value:`PanelStyle.None`, as the panel is then not drawn at all. .. property:: bool Draggable { get; set; } Whether the user can move the panel by dragging it. :Game Scenes: All .. note:: Dragging anywhere on the panel moves it, including over the elements it contains, unless one of them takes the pointer for itself. Give a panel a title bar of its own if only part of it should move it. A panel whose style is :value:`PanelStyle.None` is not drawn, so it takes no pointer events of its own and can only be dragged by the elements it contains. .. property:: Layout Layout { get; } The layout that arranges the elements of the panel, or ``null`` if they are positioned by hand. :Game Scenes: All .. function:: Layout AddHorizontalLayout() Arrange the elements of the panel in a row. :Game Scenes: All .. function:: Layout AddVerticalLayout() Arrange the elements of the panel in a column. :Game Scenes: All .. function:: Layout AddGridLayout() Arrange the elements of the panel in a grid of equally sized cells. :Game Scenes: All .. note:: The number of columns follows from the size of the panel and the size of a cell. Use :prop:`Layout.Constraint` to fix it instead. .. property:: SizeFitter SizeFitter { get; } Sizes the panel to fit what it contains. :Game Scenes: All .. note:: Both directions start out unconstrained, which leaves the size of the panel alone. .. function:: void BringToFront() Draw the panel in front of the other elements beside it. Elements are drawn in the order they were added, so of two overlapping panels the newer hides part of the older until the older is brought to the front. :Game Scenes: All .. note:: A draggable panel also brings itself to the front when the user starts dragging it, the way a window comes to the front when it is clicked. .. enum:: PanelStyle How the background of a panel is drawn. .. enumerator:: Window As a window, the heavier of the two frames the game uses. .. enumerator:: Box As a box, the lighter frame the game groups related controls in. .. enumerator:: None Not drawn at all, leaving whatever is behind the panel showing through.