Sets the frame's scale factor. A frame's scale factor affects the size at which it appears on the screen relative to that of its parent. The entire interface may be scaled by changing UIParent's scale factor (as can be done via the Use UI Scale setting in the default interface's Video Options panel).

Note that if you are saving the position of a frame, you will want to be aware of what happens when the UI scale is changed, or when the user switches aspect rations (think copying addon configs between desktop and laptop). You can see LibWindow's approach to position saving

LibWindow's approach to position saving:

Signature:

Frame:SetScale(scale)

Arguments:

  • scale - Scale factor for the frame relative to its parent (number)

Examples:

-- creates three concentric squares colored red, green and blue
-- each is 100 pixels wide according to its own coordinate system
-- but the actual size of each is determined by its scale factor:
--  - the red square is about 50 pixels square, or 0.5x its normal size (assuming UIParent's scale factor is 1)
--  - the green square is about 75 pixels square, or 1.5x the size of the red square
--  - the blue square is about 19 pixels square, or 0.25x the size of the green square
CreateFrame("Frame","Frame1", UIParent)
Frame1:SetWidth(100)
Frame1:SetHeight(100)
Frame1:SetPoint("CENTER")
Frame1:CreateTexture("Frame1BG")
Frame1BG:SetTexture(1,0,0,0.5)
Frame1BG:SetAllPoints()
Frame1:SetScale(0.5)

CreateFrame("Frame","Frame2", Frame1)
Frame2:SetWidth(100)
Frame2:SetHeight(100)
Frame2:SetPoint("CENTER")
Frame2:CreateTexture("Frame2BG")
Frame2BG:SetTexture(0,1,0,0.5)
Frame2BG:SetAllPoints()
Frame2:SetScale(1.5)

CreateFrame("Frame","Frame3", Frame2)
Frame3:SetWidth(100)
Frame3:SetHeight(100)
Frame3:SetPoint("CENTER")
Frame3:CreateTexture("Frame3BG")
Frame3BG:SetTexture(0,0,1,0.5)
Frame3BG:SetAllPoints()
Frame3:SetScale(0.25)