UIScale
*Ce contenu est traduit en utilisant l'IA (Beta) et peut contenir des erreurs. Pour consulter cette page en anglais, clique ici.
Un objet UIScale contient simplement un nombre qui est utilisé pour multiplier le GuiBase2d.AbsoluteSize de l'élément parent de l'interface utilisateur. Ce nombre est stocké dans UIScale.Scale .
Échantillons de code
This code sample creates some images of a lock and scales them using UIScale. It lays them out using a UIListLayout.
-- Lay out the images in a list
Instance.new("UIListLayout", script.Parent).SortOrder = Enum.SortOrder.LayoutOrder
-- Create some images of varying sizes using UIScale objects
for size = 0.2, 1.5, 0.2 do
local image = Instance.new("ImageLabel")
image.Image = "rbxassetid://284402752" -- an image of a Lock
image.Parent = script.Parent
image.Size = UDim2.new(0, 100, 0, 100)
-- Scale the image by adding a UIScale with the size
-- Note: this is a shorthand since we don't need a reference to the UIScale
Instance.new("UIScale", image).Scale = size
end
Résumé
Propriétés
Détermine le multiplicateur à appliquer à la taille de l'élément parent UI.
Propriétés
Scale
La propriété Échelle détermine le multiplicateur utilisé sur l'élément parent de l'interface utilisateur GuiBase2d.AbsoluteSize.Lorsqu'il est réglé sur 0.5, une taille absolue de 0, 200, 0, 50 devient 0, 100, 0, 25.De même, lorsqu'il est réglé sur 2, une telle taille absolue deviendrait 0, 400, 0, 100.
Échantillons de code
This code sample creates some images of a lock and scales them using UIScale. It lays them out using a UIListLayout.
-- Lay out the images in a list
Instance.new("UIListLayout", script.Parent).SortOrder = Enum.SortOrder.LayoutOrder
-- Create some images of varying sizes using UIScale objects
for size = 0.2, 1.5, 0.2 do
local image = Instance.new("ImageLabel")
image.Image = "rbxassetid://284402752" -- an image of a Lock
image.Parent = script.Parent
image.Size = UDim2.new(0, 100, 0, 100)
-- Scale the image by adding a UIScale with the size
-- Note: this is a shorthand since we don't need a reference to the UIScale
Instance.new("UIScale", image).Scale = size
end