用于 StyleSheet 和 StyleRule 的基础类。保存一列子 StyleRules 列表以及被存储为 属性 的代币定义。
概要
方法
返回一组相关的 StyleRules 。
插入新的 StyleRule 到规则阵列中。
与 InsertStyleRule() 类似,但允许一次宣言和设置多个 StyleRules。
活动
当一个或多个 StyleRules 在连接的 StyleSheet 或 StyleRule 上明确更改时,发生火焰。
属性
方法
InsertStyleRule
()
插入一个新的 StyleRule 到规则阵列中,使其 Priority 大于所有以前的 StyleRules 。如果 priority 被指定,将新规则的 Priority 设置为指定的值。
参数
返回
()
SetStyleRules
()
与 InsertStyleRule() 类似,但允许一次宣言和设置多个 StyleRules。
local ReplicatedStorage = game:GetService("ReplicatedStorage")local coreSheet = Instance.new("StyleSheet")coreSheet.Name = "CoreSheet"coreSheet.Parent = ReplicatedStoragelocal styleRuleA = Instance.new("StyleRule")styleRuleA.Selector = "Frame"styleRuleA:SetProperty("BackgroundColor3", Color3.new(1, 0, 0))local styleRuleB = Instance.new("StyleRule")styleRuleB.Selector = "Frame"styleRuleB:SetProperty("BackgroundColor3", Color3.new(0, 1, 0))coreSheet:SetStyleRules({ styleRuleA, styleRuleB })
参数
rules: Instances
需要设置的 StyleRules 阵列。
返回
()
活动
StyleRulesChanged
当一个或多个 StyleRules 在连接的 StyleSheet 或 StyleRule 上明确更改时,发生火灾,例如当 InsertStyleRule() 被调用时。