Fixed a bug with the Hexadecimal color selector
This commit is contained in:
@@ -128,13 +128,14 @@ namespace Paint_2
|
|||||||
private void btnSetColor_Click(object sender, EventArgs e)
|
private void btnSetColor_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
string value = tbxColorHex.Text;
|
string value = tbxColorHex.Text;
|
||||||
|
int fromBase = 16;
|
||||||
value = value.Replace("#", String.Empty);
|
value = value.Replace("#", String.Empty);
|
||||||
int R, G, B;
|
int R, G, B;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
R = Convert.ToInt32(value[0] + value[1]);
|
R = Convert.ToInt32(String.Concat(value[0], value[1]), fromBase);
|
||||||
G = Convert.ToInt32(value[2] + value[3]);
|
G = Convert.ToInt32(String.Concat(value[2], value[3]), fromBase);
|
||||||
B = Convert.ToInt32(value[4] + value[5]);
|
B = Convert.ToInt32(String.Concat(value[4], value[4]), fromBase);
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user