言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

GUILayout.MinHeight

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static function MinHeight(minHeight: float): GUILayoutOption;
public static GUILayoutOption MinHeight(float minHeight);
public static def MinHeight(minHeight as float) as GUILayoutOption

Description

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


ウィンドウの最小の高さ

	// Draws a window you can resize between 80px and 200px height
	// Just click the box inside the window and move your mouse
	private var windowRect : Rect = Rect (10, 10, 100, 100);
	private var scaling : boolean = false;
	
	function OnGUI () {
		windowRect = GUILayout.Window (0, windowRect, ScalingWindow, "resizeable", 
					       GUILayout.MinHeight(80), GUILayout.MaxHeight(200));
	}
	
	function ScalingWindow (windowID : int) {
		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 = Rect (windowRect.x, windowRect.y, 
				   windowRect.width + Event.current.delta.x, windowRect.height + Event.current.delta.y);
		}
	}
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    private Rect windowRect = new Rect(10, 10, 100, 100);
    private 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);
        
    }
}
import UnityEngine
import System.Collections

public class ExampleClass(MonoBehaviour):

	private windowRect as Rect = Rect(10, 10, 100, 100)

	private scaling as bool = false

	def OnGUI() as void:
		windowRect = GUILayout.Window(0, windowRect, ScalingWindow, 'resizeable', GUILayout.MinHeight(80), GUILayout.MaxHeight(200))

	def ScalingWindow(windowID as int) as void:
		GUILayout.Box('', GUILayout.Width(20), GUILayout.Height(20))
		if Event.current.type == EventType.MouseUp:
			scaling = false
		elif (Event.current.type == EventType.MouseDown) and GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition):
			scaling = true
		if scaling:
			windowRect = Rect(windowRect.x, windowRect.y, (windowRect.width + Event.current.delta.x), (windowRect.height + Event.current.delta.y))