Try this:
lua Code:
local frame = CreateFrame("Frame", "MyAddOn_MainFrame", UIParent)
-- Set up the main frame here
local resizeButton = CreateFrame("Button", nil, frame)
resizeButton:SetSize(16, 16)
resizeButton:SetPoint("BOTTOMRIGHT")
resizeButton:SetNormalTexture("Interface\\ChatFrame\\UI-ChatIM-SizeGrabber-Up")
resizeButton:SetHighlightTexture("Interface\\ChatFrame\\UI-ChatIM-SizeGrabber-Highlight")
resizeButton:SetPushedTexture("Interface\\ChatFrame\\UI-ChatIM-SizeGrabber-Down")
resizeButton:SetScript("OnMouseDown", function(self, button)
frame:StartSizing("BOTTOMRIGHT")
frame:SetUserPlaced(true)
end)
resizeButton:SetScript("OnMouseUp", function(self, button)
frame:StopMovingOrSizing()
end)
This should create a resize button in the bottom right corner of your main frame that looks like the chat frame resize button.
You can add a check for the left mouse button in the OnMouseUp/Down scripts like you have in your code if you want.