我正在使用C#嘗試開發(fā)以下兩個(gè)。我的操作方式可能會(huì)有問題,需要您的友善建議。另外,我不知道是否有任何現(xiàn)有方法可以做到這一點(diǎn)。private static String HexConverter(System.Drawing.Color c){ String rtn = String.Empty; try { rtn = "#" + c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2"); } catch (Exception ex) { //doing nothing } return rtn;}private static String RGBConverter(System.Drawing.Color c){ String rtn = String.Empty; try { rtn = "RGB(" + c.R.ToString() + "," + c.G.ToString() + "," + c.B.ToString() + ")"; } catch (Exception ex) { //doing nothing } return rtn;}謝謝。
將System.Drawing.Color轉(zhuǎn)換為RGB和十六進(jìn)制值
慕運(yùn)維8079593
2019-12-26 08:57:20