//Runs when the user taps a square on the canvas private void PixelTapGR_Tapped(object sender, EventArgs E) { int fromR, fromC; BoxView pixelToPaint = (BoxView)sender; pixelToPaint.BackgroundColor = Color.FromRgb(i1, i2, i3); fromR = (int)pixelToPaint.GetValue(Grid.RowProperty); fromC = (int)pixelToPaint.GetValue(Grid.ColumnProperty); _coloursStored[fromR, fromC] = selectedColour; }
//Runs when the user selects a colour from the colour menue private void ColorTapGR_Tapped(object sender, EventArgs e) { int fromR, fromC; int valueofcolour; BoxView BasicColourPicked = (BoxView)sender; fromR = (int)BasicColourPicked.GetValue(Grid.RowProperty); fromC = (int)BasicColourPicked.GetValue(Grid.ColumnProperty); valueofcolour = fromC + (fromR * 8); #region Colour Picker switch (valueofcolour) { case 0: r = 0; g = 0; b = 0; SetcolourFromMenue(r, g, b); break; // Black case 1: r = 255; g = 255; b = 255; SetcolourFromMenue(r, g, b); break; // White case 2: r = 255; g = 0; b = 0; SetcolourFromMenue(r, g, b); break; // Red case 3: r = 0; g = 255; b = 0; SetcolourFromMenue(r, g, b); break; // Green case 4: r = 0; g = 0; b = 255; SetcolourFromMenue(r, g, b); break; // Blue case 5: r = 255; g = 255; b = 0; SetcolourFromMenue(r, g, b); break; // Yellow case 6: r = 0; g = 255; b = 255; SetcolourFromMenue(r, g, b); break; // Cyan case 7: r = 255; g = 0; b = 255; SetcolourFromMenue(r, g, b); break; // Magenta case 8: r = 192; g = 192; b = 192; SetcolourFromMenue(r, g, b); break; // Silver case 9: r = 128; g = 128; b = 128; SetcolourFromMenue(r, g, b); break; // Grey case 10: r = 128; g = 0; b = 0; SetcolourFromMenue(r, g, b); break; // Maroon case 11: r = 128; g = 128; b = 0; SetcolourFromMenue(r, g, b); break; // Olive case 12: r = 0; g = 128; b = 0; SetcolourFromMenue(r, g, b); break; // Dark-Green case 13: r = 128; g = 0; b = 128; SetcolourFromMenue(r, g, b); break; // Purple case 14: r = 0; g = 128; b = 128; SetcolourFromMenue(r, g, b); break; // Teal case 15: r = 0; g = 0; b = 128; SetcolourFromMenue(r, g, b); break; // Navy } #endregion }