Quantcast
WoWInterface - View Single Post - How to add a thin border to a frame?
View Single Post
12-16-20, 03:03 AM   #15
Zax
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 96
Considring Fizzlemizz's script, is there a way to modify border color of an existing border, previously created with his script?

Lua Code:
  1. local function CreateBorder(self)
  2.     if not self.borders then
  3.         self.borders = {}
  4.         for i=1, 4 do
  5.             self.borders[i] = self:CreateLine(nil, "BACKGROUND", nil, 0)
  6.             local l = self.borders[i]
  7.             l:SetThickness(1)
  8.             l:SetColorTexture(1, 1, 0, 1)
  9.             if i==1 then
  10.                 l:SetStartPoint("TOPLEFT")
  11.                 l:SetEndPoint("TOPRIGHT")
  12.             elseif i==2 then
  13.                 l:SetStartPoint("TOPRIGHT")
  14.                 l:SetEndPoint("BOTTOMRIGHT")
  15.             elseif i==3 then
  16.                 l:SetStartPoint("BOTTOMRIGHT")
  17.                 l:SetEndPoint("BOTTOMLEFT")
  18.             else
  19.                 l:SetStartPoint("BOTTOMLEFT")
  20.                 l:SetEndPoint("TOPLEFT")
  21.             end
  22.         end
  23.     end
  24. end
  25.  
  26. local f = CreateFrame("Frame")
  27. f:SetSize(40, 40)
  28. f:SetPoint("CENTER")
  29. f.bg = f:CreateTexture()
  30. f.bg:SetAllPoints()
  31. f.bg:SetTexture("Interface/BUTTONS/WHITE8X8")
  32. f.bg:SetVertexColor(0, 0, 0)
  33. f:SetResizable(true)
  34. f:EnableMouse(true)
  35. f:RegisterForDrag("LeftButton")
  36. f:SetScript("OnDragStart", function(self)
  37.     self:StartSizing("BOTTOMRIGHT")
  38. end)
  39. f:SetScript("OnDragStop", function(self)
  40.     self:StopMovingOrSizing()
  41. end)
  42.  
  43. CreateBorder(f)
  Reply With Quote