private void pictureBox1_MouseDown(object sender, MouseButtonEventArgs e) { pictureBoxClicked(); Random random = new Random(); AllSelData asd = new AllSelData(); int randomResault = random.Next(1, asd.getMainStrCount()); byte[] randomStrColor = pictureStrColorBackRandom(); text.Foreground = new SolidColorBrush(Color.FromArgb(255, randomStrColor[0], randomStrColor[1], randomStrColor[2])); text.Content = asd.getMainStr(randomResault); }