Unity3D圣典3.3版本-中文版
文集大纲加载中……
本文档使用 MrDoc 发布
-
+
首页
GUI.HorizontalScrollbar 水平滚动条
# [GUI](GUI.html).HorizontalScrollbar 水平滚动条 static function HorizontalScrollbar (position : Rect, value : float, size : float, leftValue : float, rightValue : float) : float static function HorizontalScrollbar (position : Rect, value : float, size : float, leftValue : float, rightValue : float, style : GUIStyle) : float ### Parameters**参数** * *position* Rectangle on the screen to use for the scrollbar. 用于滚动条在屏幕上矩形的位置。 * *value* The position between min and max 在 min 和 max 之间的位置 * *size* How much can we see? 我们能看到多大 * *leftValue* The value at the left end of the scrollbar 滚动条最左边的值 * *rightValue* The value at the right end of the scrollbar 滚动条最右边的值 * *style* The style to use for the scrollbar background. If left out, the horizontalScrollbar style from the current GUISkin is used. 用于滚动条背景的样式,如果不设置,水平滚动条样式应用当前的 GUISkin 皮肤 *Returns* float - the modified value. This can be changed by the user by dragging the scrollbar, or clicking the arrows at the end. 返回 float 类型,被修改值。这能通过用户拖动滚动条,或点击滚动条上的箭头来改变值。 *Description* 描述 Make a horizontal scrollbar. Scrollbars are what you use to scroll through a document. Most likely, you want to use scrollViews instead. 创建水平滚动条。滚动条是能通过滚动来浏览文档,大多数情况下,你可以使用 scrollView 代替。 * [C#](#) * [JavaScript](#) ``` using UnityEngine; using System.Collections; public class example : MonoBehaviour { public float hSbarValue; void OnGUI() { hSbarValue = GUI.HorizontalScrollbar(new Rect(25, 25, 100, 30), hSbarValue, 1.0F, 0.0F, 10.0F); } } ``` ``` var hSbarValue : float; function OnGUI () { hSbarValue = GUI.HorizontalScrollbar(Rect (25, 25, 100, 30), hSbarValue, 1.0, 0.0, 10.0); } ``` ### Finding extra elements 查找额外的元素: The styles of the buttons at the end of the scrollbar are searched for in the current skin by adding "leftbutton" and "rightbutton" to the style name. The name of the scrollbar thumb (the thing you drag) is found by appending "thumb" to the style name. 滚动条两端的按钮的样式是在当前皮肤中搜索 "leftbutton"和"rightbutton"样式名字确定。滚动条滑块的样式是搜索 "thumb"的样式名。 ``` var scrollPos : float = 0.5; // This will use the following style names to determine the size / placement of the buttons //这将使用跟随的样式名字来确定按钮的大小/ 放置 // MyScrollbarleftbutton - Name of style used for the left button. //MyScrollbarleftbutton - 用于左边按钮样式的名字 // MyScrollbarrightbutton - Name of style used for the right button. //MyScrollbarrightbutton - 用于右边按钮样式的名字 // MyScrollbarthumb - Name of style used for the draggable thumb. //MyScrollbarthumb - 用于拖动滑块样式的名字 function OnGUI() { scrollPos = GUI.HorizontalScrollbar(Rect(0,0,100,20), scrollPos, 1, 0, 100, "Scroll"); } ```
da
2022年5月23日 13:46
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
分享
链接
类型
密码
更新密码