Convert.ToInt32(s, 16)
private void ConvertToRgb() { try { string hex = "000000" + uxHexTextBox.Text ; hex = hex.Substring(hex.Length - 6, 6); string result = "RGB("; for (int i = 0; i <= 4; i += 2) { string s = hex.Substring(i, 2); result += Convert.ToInt32(s, 16).ToString(); if (i < 4) result += ", "; } result += ")"; uxRgbTextBox.Text = result; Clipboard.SetText(result); uxHexTextBox.SelectAll(); } catch (Exception ex) { MessageBox.Show(ex.Message, Application.ProductName); } }
int i = 32; string s = String.Format("{0:X}", i);
ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.