Version: 2022.3
言語: 日本語
public static GUILayoutOption MinHeight (float minHeight);

説明

コントロールの高さの最小値を設定するオプション


Minimum height for a window.

using UnityEngine;

public class ExampleScript : MonoBehaviour { // Draws a window you can resize between 80px and 200px height // Just click the box inside the window and move your mouse Rect windowRect = new Rect(10, 10, 100, 100); bool scaling = false;

void OnGUI() { windowRect = GUILayout.Window(0, windowRect, ScalingWindow, "resizeable", GUILayout.MinHeight(80), GUILayout.MaxHeight(200)); }

void ScalingWindow(int windowID) { GUILayout.Box("", GUILayout.Width(20), GUILayout.Height(20)); if (Event.current.type == EventType.MouseUp) { scaling = false; } else if (Event.current.type == EventType.MouseDown && GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition)) { scaling = true; }

if (scaling) { windowRect = new Rect(windowRect.x, windowRect.y, windowRect.width + Event.current.delta.x, windowRect.height + Event.current.delta.y); } } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961