Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. public void MakeLabels()
  2. {
  3. word = GetRandomWord();
  4. char[] chars = word.ToCharArray();
  5. int between = 330 / chars.Length;
  6. for (int i = 0; i < chars.Length; i++)
  7. {
  8. labels.Add(new Label());
  9. labels[i].Location = new Point((i * between) + 10, 80);
  10. labels[i].Text = "_";
  11. labels[i].Parent = groupBox1;
  12. labels[i].BringToFront();
  13. labels[i].CreateControl();
  14. }
  15. }
  16.  
  17. string word = "слово";
  18. string encryptWord = word[0] + (new string('_', word.Length - 1));
  19.  
  20. private string HideCharacters(string word)
  21. {
  22. string res = word[0].ToString();
  23. for (int i = 1; i < word.Length; i++)
  24. res += " _";
  25. return res;
  26. }
  27.  
  28. static string NewWord(string src)
  29. {
  30. return src[0] + new string(src.Skip(1).Select(x => '_').ToArray());
  31. }
  32.  
  33. static string NewWord(string src)
  34. {
  35. return src[0] + Regex.Replace(src.Substring(1), ".", "_");
  36. }
  37.  
  38. for (int i = 0; i < chars.Length; i++)
  39. {
  40. labels.Add(new Label());
  41. labels[i].Location = new Point((i * between) + 10, 80);
  42. if(i!=0)labels[i].Text = "_";
  43. labels[i].Parent = groupBox1;
  44. labels[i].BringToFront();
  45. labels[i].CreateControl();
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement