diff --git a/Paint_2/Form1.cs b/Paint_2/Form1.cs index 6279a7d..389e76c 100644 --- a/Paint_2/Form1.cs +++ b/Paint_2/Form1.cs @@ -128,13 +128,14 @@ namespace Paint_2 private void btnSetColor_Click(object sender, EventArgs e) { string value = tbxColorHex.Text; + int fromBase = 16; value = value.Replace("#", String.Empty); int R, G, B; try - { - R = Convert.ToInt32(value[0] + value[1]); - G = Convert.ToInt32(value[2] + value[3]); - B = Convert.ToInt32(value[4] + value[5]); + { + R = Convert.ToInt32(String.Concat(value[0], value[1]), fromBase); + G = Convert.ToInt32(String.Concat(value[2], value[3]), fromBase); + B = Convert.ToInt32(String.Concat(value[4], value[4]), fromBase); } catch (Exception exception) {