Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[-------------------------------------------------------------------------
- Button test
- ---------------------------------------------------------------------------]]
- local DPanel52 = vgui.Create( "DButton" )
- DPanel52:SetPos( ScrW()/2-100, 130 ) -- Set the position of the panel
- DPanel52:SetSize( 200, 50 ) -- Set the size of the panel
- DPanel52:SetText("")
- --DPanel52:Center()
- DPanel52.isActive = false
- DPanel52.Paint = function (self, w, h)
- if self:IsHovered() then
- draw.RoundedBoxEx(15,0,0,w,50,Color(255, 255, 255),true,true,true,true)
- draw.RoundedBox(15,0,0+2,w,h,Color(83, 89, 102, 255))
- draw.SimpleText("Hover Effect Button", "Roboto_24", w * .5, h * .5, Color(87,131,192), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
- else
- draw.RoundedBoxEx(15,0,0,w,50,Color(255, 255, 255),true,true,true,true)
- draw.RoundedBox(15,0,0+2,w,h,Color(53, 59, 72, 255))
- draw.SimpleText("Hover Effect Button", "Roboto_24", w * .5, h * .5, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
- if self.isActive then
- draw.RoundedBoxEx(15,0,0,w,50,Color(45, 192, 82),true,true,true,true)
- draw.RoundedBox(15,0,0+2,w,h,Color(53, 59, 72, 255))
- draw.SimpleText("Hover Effect Button", "Roboto_24",w/2,h/2,Color(255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
- else
- draw.RoundedBoxEx(15,0,0,w,50,Color(255, 255, 255),true,true,true,true)
- draw.RoundedBox(15,0,0+2,w,h,Color(53, 59, 72, 255))
- draw.SimpleText("Hover Effect Button", "Roboto_24",w/2,h/2,Color(255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
- --Not work--
- if self:IsHovered() || self.isActive then
- draw.RoundedBoxEx(15,0,0,w,50,Color(45, 192, 82),true,true,true,true)
- draw.RoundedBox(15,0,0+2,w,h,Color(83, 89, 102, 255))
- draw.SimpleText("Hover Effect Button", "Roboto_24",w/2,h/2,Color(255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
- else
- draw.RoundedBoxEx(15,0,0,w,50,Color(255, 255, 255),true,true,true,true)
- draw.RoundedBox(15,0,0+2,w,h,Color(53, 59, 72, 255))
- draw.SimpleText("Hover Effect Button", "Roboto_24",w/2,h/2,Color(255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
- end
- --Not work--
- end
- end
- -- if self.isActive then
- -- draw.RoundedBoxEx(15,0,0,w,50,Color(45, 192, 82),true,true,true,true)
- -- draw.RoundedBox(15,0,0+2,w,h,Color(53, 59, 72, 255))
- -- draw.SimpleText("Bouton", "Roboto_24",w/2,h/2,Color(255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
- -- else
- -- draw.RoundedBoxEx(15,0,0,w,50,Color(255, 255, 255),true,true,true,true)
- -- draw.RoundedBox(15,0,0+2,w,h,Color(53, 59, 72, 255))
- -- draw.SimpleText("Bouton", "Roboto_24",w/2,h/2,Color(255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
- -- end
- end
- DPanel52.DoClick = function (self)
- self.isActive = not self.isActive
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement