Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Another way to draw rounded rectangles
#2
A simpler version of your packcolor, which you might want to use to help things run a little more efficiently, if that's ever an issue for you:

Code: (Select All)
$Color:32
Print packcolorN(Red), pcN(Red)
Print packcolorN(Green), pcN(Green)
Print packcolorN(Blue), pcN(Blue)
Print packcolorN(Gold), pcN(Gold)
Print packcolorN(BrickRed), pcN(BrickRed)



Function pcN$ (klr As _Unsigned Long)
pcN$ = "#" + Right$("000000" + Hex$(klr And &HFFFFFF), 6)
End Function


Function packcolorN$ (klr As _Unsigned Long)
'convert an unsigned long color value into a hexidecimal string # that will be used in an SVG
Dim As _Unsigned Long rk, gk, bk
'get the color channels of the unsinged long color
rk = _Red32(klr)
gk = _Green32(klr)
bk = _Blue32(klr)
'convert those channel values into hexidecimal
If rk < 16 Then
r$ = "0" + Hex$(rk) 'put in a padded hexidcimal value
Else
r$ = Hex$(rk) 'put in a 2 digit hexidecimal value
End If
If gk < 16 Then
g$ = "0" + Hex$(gk) 'put in a padded hexidcimal value
Else
g$ = Hex$(gk) 'put in a 2 digit hexidecimal value
End If
If bk < 16 Then
b$ = "0" + Hex$(bk) 'put in a padded hexidcimal value
Else
b$ = Hex$(bk) 'put in a 2 digit hexidecimal value
End If
packcolorN$ = "#" + r$ + g$ + b$
End Function
Reply


Messages In This Thread
RE: Another way to draw rounded rectangles - by SMcNeill - 09-19-2024, 09:12 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Draw Worms Study bplus 15 899 01-01-2026, 08:23 PM
Last Post: bplus
  Draw that Circle James D Jarvis 17 3,326 08-28-2022, 06:29 AM
Last Post: justsomeguy
  Draw circles James D Jarvis 5 1,501 06-16-2022, 12:09 PM
Last Post: James D Jarvis
  rounded rectangles and buttons James D Jarvis 5 1,631 04-30-2022, 01:51 AM
Last Post: bplus

Forum Jump:


Users browsing this thread: 1 Guest(s)