Rounded Rectangles?
-
- Coder
- Posts: 19
- Joined: Thu Sep 08, 2005 3:14 am
Rounded Rectangles?
Does anyone know how to do this in Qbasic? I've seen it before. It's probably something ridiculously easy... If you don't know, I mean the rectangles with rounded edges, like the buttons in MacOS and stuff like that.
Well, your gonna need on LINE command and one CIRCLE command. Start off by drawing your box of lines except cut them off by whatever the radius of your rounded circle edges will be. Next, draw the circle at the "would be" intersection point of all the lines(top left, top right, ect...) except only draw sections corresponding with the angles so
top left = 90 to 180
top right = 180 to 270
bottom right = 270 to 0
bottom left = 0 to 90
Im sorry, this is really confusing but I dont feel like actually doing any work . Ill hope somebody else gives you some code.
top left = 90 to 180
top right = 180 to 270
bottom right = 270 to 0
bottom left = 0 to 90
Im sorry, this is really confusing but I dont feel like actually doing any work . Ill hope somebody else gives you some code.
C:\DOS
C:\DOS\RUN
RUN\DOS\RUN
C:\DOS\RUN
RUN\DOS\RUN
Code: Select all
declare sub rbox(x1,y1,x2,y2,c,r)
const pi=3.1415926
screen 12
rbox 50,50,150,150,6,17
sub rbox(x1,y1,x2,y2,c,r)
line (x1,y1+r)-(x1,y2-r),c
line (x1+r,y1)-(x2-r,y1),c
line (x2,y1+r)-(x2,y2-r),c
line (x2-r,y2)-(x1+r,y2),c
circle (x1+r,y1+r),r,c,pi*0.5,pi
circle (x2-r,y1+r),r,c,0,pi*0.5
circle (x1+r,y2-r),r,c,pi,pi*1.5
circle (x2-r,y2-r),r,c,pi*1.5
end sub
-
- Coder
- Posts: 19
- Joined: Thu Sep 08, 2005 3:14 am