SUB that draws boxes with rounded corners. - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Programs (https://qb64phoenix.com/forum/forumdisplay.php?fid=7) +---- Thread: SUB that draws boxes with rounded corners. (/showthread.php?tid=3032) |
SUB that draws boxes with rounded corners. - Dav - 09-14-2024 Needed a SUB to draw boxes with rounded corners, filled or unfilled. Here's what came out of it. You can control the amount of corner rounded-ness by giving a radius value. I made a smaller one using the filled circle routine (circle for each corner), but it only could do filled boxes, so used arc routines to draw them. Probably someone has a better method to do this, just thought I'd throw mine into the mix. - Dav EDIT: Code fixed! Code: (Select All)
RE: SUB that draws boxes with rounded corners. - Petr - 09-14-2024 Hi, thanks for sharing. You saved me work again that will come in handy. I would proceed the same way in the program. RE: SUB that draws boxes with rounded corners. - SMcNeill - 09-14-2024 https://qb64phoenix.com/forum/showthread.php?tid=2091 RE: SUB that draws boxes with rounded corners. - bplus - 09-14-2024 https://qb64phoenix.com/forum/showthread.php?tid=272&pid=1218#pid1218 RE: SUB that draws boxes with rounded corners. - Dav - 09-14-2024 (09-14-2024, 04:33 PM)SMcNeill Wrote: https://qb64phoenix.com/forum/showthread.php?tid=2091 Neat routines! I need to make it habit of skimming through your area first before trying to come up with something. EDIT: Yours too, @bplus. Nice. - Dav RE: SUB that draws boxes with rounded corners. - SMcNeill - 09-14-2024 There's a lot of stuff out there that's already been created and used for years now -- we're not a young and undeveloped project anymore. The problem is always finding it when you need it. There's just soooo much quality stuff by everyone, that it's hard to remember it all, so many of us just end up reinventing the wheel over and over. RE: SUB that draws boxes with rounded corners. - Dav - 09-14-2024 Looks like I have an error somewhere, my box positions aren't lining up. Will fix it... - Dav RE: SUB that draws boxes with rounded corners. - RhoSigma - 09-14-2024 Basically you could also take my Polygon drawing library. Just define the shape of the box as series of x/y points and then call FillPolygon. I use this e.g. in my GuiTools to draw the tooltip speaking bubbles as you see in the pictures here, but basically every shape would be possible like sine wave borders or ellipse boxes etc.. RE: SUB that draws boxes with rounded corners. - DANILIN - 09-14-2024 Line 18 If Rnd > .33 Then Print ' Danilin or simple and picture fly up ... since 1990-th plus: automatic MazeBall https://qb64phoenix.com/forum/showthread.php?tid=2761&pid=28378#pid28378 RE: SUB that draws boxes with rounded corners. - Dav - 09-14-2024 I fixed the code. It is updated, and works correctly now. I sure had the x2/y2 all messed up. So, @Petr, if you do use this please get the updated code, old one is no good. @RhoSigma: Thank you. Your libraries are outstanding and very professional! - Dav |