Again, the same as Kanegasi but slightly different in order to bake the border colouring into your created frames:
Lua Code:
local function ColorBorders(self, r, g, b, a)
for i=1, 4 do
self.borders[i]:SetColorTexture(r, g, b, a and a or 1)
end
end
local function CreateBorderFrame(name, thickness)
local f = CreateFrame("Frame", name)
f:SetSize(40, 40)
f.bg = f:CreateTexture()
f.bg:SetAllPoints()
f.bg:SetTexture("Interface/BUTTONS/WHITE8X8")
f.bg:SetVertexColor(0, 0, 0)
f:SetResizable(true)
f:EnableMouse(true)
f:RegisterForDrag("LeftButton")
f:SetScript("OnDragStart", function(self)
self:StartSizing("BOTTOMRIGHT")
end)
f:SetScript("OnDragStop", function(self)
self:StopMovingOrSizing()
end)
f.SetBorderColor = ColorBorders
f.borders = {}
local offset = (thickness/2)
for i=1, 4 do
f.borders[i] = f:CreateLine(nil, "BACKGROUND", nil, 0)
local l = f.borders[i]
l:SetThickness(thickness)
l:SetColorTexture(1, 1, 0, 1)
if i==1 then
l:SetStartPoint("TOPLEFT", -offset, 0)
l:SetEndPoint("TOPRIGHT", offset, 0)
elseif i==2 then
l:SetStartPoint("TOPRIGHT", 0, offset)
l:SetEndPoint("BOTTOMRIGHT", 0, -offset)
elseif i==3 then
l:SetStartPoint("BOTTOMRIGHT", offset, 0)
l:SetEndPoint("BOTTOMLEFT", -offset, 0)
else
l:SetStartPoint("BOTTOMLEFT", 0, -offset)
l:SetEndPoint("TOPLEFT", 0, offset)
end
end
return f
end
local f = CreateBorderFrame("ZaxFrame1", 1)
f:SetPoint("RIGHT", UIParent, "CENTER", -20, 0)
f = CreateBorderFrame("ZaxFrame2", 18)
f:SetPoint("LEFT", UIParent, "CENTER", 20, 0)
ZaxFrame2:SetBorderColor(0.2, 0.5, 0.8)