[點(diǎn)晴永久免費(fèi)OA] ASP將HEX16進(jìn)制顏色值與RGB顏色值互相轉(zhuǎn)換
HEX十六進(jìn)制轉(zhuǎn)換為RGB: Dim hexval : hexval = "fdfeff" Dim rgbval : rgbval = CLng("&h" & hexval) Dim r_RGB : r_RGB = (rgbval And &hff0000&)/65536 Dim g_RGB : g_RGB= (rgbval And &h00ff00&)/256 Dim b_RGB : b_RGB= (rgbval And &h0000ff&) RGB轉(zhuǎn)換為HEX十六進(jìn)制: if not len(r_RGB)=0 and not len(g_RGB)=0 and not len(b_RGB)=0 and isnumeric(r_RGB) and isnumeric(g_RGB) and isnumeric(b_RGB) then if cint(r_RGB)<0 then r_RGB=0 if cint(r_RGB)>255 then r_RGB=255 if cint(g_RGB)<0 then g_RGB=0 if cint(g_RGB)>255 then g_RGB=255 if cint(b_RGB)<0 then b_RGB=0 if cint(b_RGB)>255 then b_RGB=255 r_HEX=hex(r_RGB) g_HEX=hex(g_RGB) b_HEX=hex(b_RGB) if len(r_HEX)=1 then r_HEX="0" & r_HEX if len(g_HEX)=1 then g_HEX="0" & g_HEX if len(b_HEX)=1 then b_HEX="0" & b_HEX disp_col="#" & r_HEX & g_HEX & b_HEX else r_RGB=0 g_RGB=0 b_RGB=0 disp_col="#000000" end if 該文章在 2023/4/14 0:57:55 編輯過(guò) |
關(guān)鍵字查詢(xún)
相關(guān)文章
正在查詢(xún)... |