Preventing GUI Elements From Drawing Outside of Window

It’s me again. I’m having a bit of a problem with setting up my GUI windows. My windows are full of texts and images that are bigger than the windows themselves. When I play my game, the elements go over the border of the window! I was wondering if there was a way to only allow these elements to draw inside their respective windows. For example, if you’re running a Windows system and scroll a window, you’ll see that the icons of folders can be cut in half and only draw their upper halves. This was the kind of thing I wanted to replicate in my game.

Thanks in advance!

I presume that you’re using DirectGUI, given that no other GUI system is mentioned. If I’m correct in that, you could perhaps use DirectScrolledFrames for your windows–that class should automatically crop elements that exceed its bounds.

[edit] And if you don’t want to use DirectScrolledFrame, you could perhaps implement your own cropping via a ScissorEffect, as I believe that DirectScrolledFrame does behind the scenes.