马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
- [FONT=courier new]
- ' . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
- '
- 'Returns RGB equivalent to passed acad color index (ACI)
- '
- Public Function AcadToRGB(ByVal Col As Long) As Variant
-
- Dim R As Long, G As Long, B As Long
-
- Select Case Col
- Case 1: AcadToRGB = 255: Exit Function
- Case 2: AcadToRGB = 65535: Exit Function
- Case 3: AcadToRGB = 65280: Exit Function
- Case 4: AcadToRGB = 16776960: Exit Function
- Case 5: AcadToRGB = 16711680: Exit Function
- Case 6: AcadToRGB = 16711935: Exit Function
- Case 7: AcadToRGB = 16777215: Exit Function
- Case 8: AcadToRGB = 8355711: Exit Function
- Case 9: AcadToRGB = 12566463: Exit Function
- Case 10: AcadToRGB = 255: Exit Function
- Case 11: AcadToRGB = 8355839: Exit Function
- Case 12: AcadToRGB = 207: Exit Function
- Case 13: AcadToRGB = 6316239: Exit Function
- Case 14: AcadToRGB = 144: Exit Function
- Case 15: AcadToRGB = 5197712: Exit Function
- Case 16: AcadToRGB = 127: Exit Function
- Case 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, _
- 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, _
- 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178: R = 0
- Case 88, 188: R = 15
- Case 86, 186: R = 31
- Case 78, 84, 99, 109, 119, 129, 139, 149, 159, 169, 179, 184, 198: R = 32
- Case 82, 89, 182, 189, 250: R = 47
- Case 68, 79, 199, 208: R = 48
- Case 69, 76, 80, 97, 107, 117, 127, 137, 147, 157, 167, 177, 180, 196, 209: R = 63
- Case 18, 19, 28, 29, 38, 39, 48, 49, 58, 59, 74, 87, 95, 105, 115, 125, 135, _
- 145, 155, 165, 175, 187, 194, 218, 219, 228, 229, 238, 239, 248, 249: R = 79
- Case 66, 77, 185, 197, 206: R = 95
- Case 72, 85, 93, 103, 113, 123, 133, 143, 153, 163, 173, 192: R = 96
- Case 64, 67, 75, 195, 204, 207: R = 111
- Case 17, 26, 27, 36, 37, 46, 47, 56, 57, 70, 83, 91, 101, 111, 121, 131, _
- 141, 151, 161, 171, 183, 190, 216, 217, 226, 227, 236, 237, 246, 247: R = 127
- Case 65, 205, 252: R = 128
- Case 24, 25, 34, 35, 44, 45, 54, 55, 62, 73, 193, 202, 214, 215, 224, 225, _
- 234, 235, 244, 245: R = 144
- Case 81, 181: R = 159
- Case 63, 203, 253: R = 175
- Case 60, 71, 191, 200: R = 191
- Case 22, 23, 32, 33, 42, 43, 52, 53, 212, 213, 222, 223, 232, 233, 242, 243: R = 207
- Case 61, 201: R = 223
- Case 20, 21, 30, 31, 40, 41, 50, 51, 210, 211, 220, 221, 230, 231, 240, 241, 255: R = 255
- Case 251: R = 80: G = 80: B = 80
- Case 254: R = 208: G = 208: B = 208
- End Select
-
- Select Case Col
- Case 18, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, _
- 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, _
- 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, 246, 248: G = 0
- Case 28, 168: G = 15
- Case 26, 166: G = 31
- Case 19, 24, 38, 158, 164, 179, 189, 199, 209, 219, 229, 239, 249: G = 32
- Case 22, 29, 162, 169, 250: G = 47
- Case 39, 48, 148, 159: G = 48
- Case 17, 20, 36, 49, 149, 156, 160, 177, 187, 197, 207, 217, 227, 237, 247: G = 63
- Case 18, 27, 34, 58, 59, 68, 69, 78, 79, 88, 89, 98, 99, 108, 109, 118, 119, _
- 128, 129, 138, 139, 154, 167, 175, 185, 195, 205, 215, 225, 235, 245: G = 79
- Case 152: G = 86
- Case 25, 37, 46, 146, 157, 165: G = 95
- Case 32, 173, 183, 193, 203, 213, 223, 233, 243: G = 96
- Case 35, 44, 47, 144, 147, 155: G = 111
- Case 23, 30, 56, 57, 66, 67, 76, 77, 86, 87, 96, 97, 106, 107, 116, 117, _
- 126, 127, 136, 137, 150, 163, 171, 181, 191, 201, 211, 221, 231, 241: G = 127
- Case 45, 145, 252: G = 128
- Case 33, 42, 54, 55, 64, 65, 74, 75, 84, 85, 94, 95, 104, 105, 114, 115, _
- 124, 125, 134, 135, 142, 153: G = 144
- Case 21, 161: G = 159
- Case 43, 143, 253: G = 175
- Case 31, 40, 140, 151: G = 191
- Case 52, 53, 62, 63, 72, 73, 82, 83, 92, 93, 102, 103, 112, 113, 122, 123, _
- 132, 133: G = 207
- Case 41, 141: G = 223
- Case 50, 51, 60, 61, 70, 71, 80, 81, 90, 91, 100, 101, 110, 111, 120, 121, _
- 130, 131, 255: G = 255
- End Select
-
- Select Case Col
- Case 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, _
- 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, _
- 92, 94, 96, 98: B = 0
- Case 108, 248: B = 15
- Case 106, 246: B = 31
- Case 19, 29, 39, 49, 59, 69, 79, 89, 99, 104, 118, 238, 244: B = 32
- Case 102, 109, 242, 249, 250: B = 47
- Case 119, 128, 228, 239: B = 48
- Case 17, 27, 37, 47, 57, 67, 77, 87, 97, 100, 116, 129, 229, 236, 240: B = 63
- Case 25, 35, 45, 55, 65, 75, 85, 95, 107, 114, 138, 139, 148, 149, 158, 159, _
- 168, 169, 178, 179, 188, 189, 198, 199, 208, 209, 218, 219, 234, 247: B = 79
- Case 105, 117, 126, 226, 237, 245: B = 95
- Case 23, 33, 43, 53, 63, 73, 83, 93, 112, 232: B = 96
- Case 115, 124, 127, 224, 227, 235: B = 111
- Case 21, 31, 41, 51, 61, 71, 81, 91, 103, 110, 136, 137, 146, 147, 156, 157, _
- 166, 167, 176, 177, 186, 187, 196, 197, 206, 207, 216, 217, 230, 243: B = 127
- Case 125, 225, 252: B = 128
- Case 113, 122, 134, 135, 144, 145, 154, 155, 164, 165, 174, 175, 184, 185, _
- 194, 195, 204, 205, 214, 215, 222, 233: B = 144
- Case 101, 241: B = 159
- Case 123, 223, 253: G = 175
- Case 111, 120, 220, 231: B = 191
- Case 132, 133, 142, 143, 152, 153, 162, 163, 172, 173, 182, 183, 192, 193, _
- 202, 203, 212, 213: B = 207
- Case 121: B = 223
- Case 130, 131, 140, 141, 150, 151, 160, 161, 170, 171, 180, 181, 190, 191, _
- 200, 201, 210, 211, 221, 255: B = 255
- End Select
-
- AcadToRGB = RGB(R, G, B)
-
- End Function
- [/FONT]
|