GUI.Toolbar 工具栏

static function Toolbar (position : Rect, selected : int, texts : String[]) : int
static function Toolbar (position : Rect, selected : int, images : Texture[]) : int
static function Toolbar (position : Rect, selected : int, content : GUIContent[]) : int
static function Toolbar (position : Rect, selected : int, texts : String[], style : GUIStyle) : int
static function Toolbar (position : Rect, selected : int, images : Texture[], style : GUIStyle) : int
static function Toolbar (position : Rect, selected : int, contents : GUIContent[], style : GUIStyle) : int

Parameters参数

Returns

int - The index of the selected button.

返回int类型,被选择按钮的索引号。

Description描述

Make a toolbar

创建工具栏。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public int toolbarInt = 0;
	public string[] toolbarStrings = new string[] {"Toolbar1", "Toolbar2", "Toolbar3"};
	void OnGUI() {
		toolbarInt = GUI.Toolbar(new Rect(25, 25, 250, 30), toolbarInt, toolbarStrings);
	}
}
var toolbarInt : int = 0;
var toolbarStrings : String[] = ["Toolbar1", "Toolbar2", "Toolbar3"];

function OnGUI () {
	toolbarInt = GUI.Toolbar(Rect (25, 25, 250, 30), toolbarInt, toolbarStrings);
}
Page last updated: 2011-1-14