// Get Color from the center pixel of the skCanvasView void GetColor() { double dX = centerX - x0; double dY = centerY - y0; if (dX < 0 || dY < 0) { ColorMonitor.BackgroundColor = Color.White; ColorCode.Text = " "; return; } int x = (int)(w0 * dX / width); int y = (int)(h0 * dY / height); if (x > w0 || y > h0) { ColorMonitor.BackgroundColor = Color.White; ColorCode.Text = " "; return; } skColor = skBitmap.GetPixel(x, y); ColorMonitor.BackgroundColor = Color.FromHex(skColor.ToString()); ColorCode.Text = skColor.ToString(); // Set TextColor the inverted BackGroundColor double r = (int)skColor.Red ^ 0xff; double g = (int)skColor.Green ^ 0xff; double b = (int)skColor.Blue ^ 0xff; ColorCode.TextColor = Color.FromRgb(r, g, b); Red.Text = "R: " + skColor.Red.ToString(); Green.Text = "G: " + skColor.Green.ToString(); Blue.Text = "B: " + skColor.Blue.ToString(); }
public override string ToString() { return(Main.ToString()); }