Form4.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace KazarinPractica03
  11. {
  12. public partial class Form4 : Form
  13. {
  14. public Form4()
  15. {
  16. InitializeComponent();
  17. // задаем обработчик события
  18. linkLabel1.LinkClicked += linkLabel1_LinkClicked;
  19. AutoCompleteStringCollection source = new AutoCompleteStringCollection()
  20. {
  21. "Кузнецов",
  22. "Иванов",
  23. "Петров",
  24. "Кустов"
  25. };
  26. textBox2.AutoCompleteCustomSource = source;
  27. textBox2.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
  28. textBox2.AutoCompleteSource = AutoCompleteSource.CustomSource;
  29. textBox4.TextChanged += textBox4_TextChanged;
  30. }
  31. private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
  32. {
  33. System.Diagnostics.Process.Start("http://metanit.com");
  34. }
  35. private void textBox4_TextChanged(object sender, EventArgs e)
  36. {
  37. label4.Text = textBox4.Text;
  38. }
  39. private void Form4_Load(object sender, EventArgs e)
  40. {
  41. }
  42. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  43. {
  44. CheckBox checkBox = (CheckBox)sender; // приводим отправителя к элементу типа CheckBox
  45. if (checkBox.Checked == true)
  46. {
  47. MessageBox.Show("Флажок " + checkBox.Text + " теперь отмечен");
  48. }
  49. else
  50. {
  51. MessageBox.Show("Флажок " + checkBox.Text + " теперь не отмечен");
  52. }
  53. }
  54. }
  55. }