我正在使用C#嘗試開發(fā)以下兩個。我的操作方式可能會有問題,需要您的友善建議。另外,我不知道是否有任何現有方法可以做到這一點。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轉換為RGB和十六進制值
慕運維8079593
2019-12-26 08:57:20