Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.22 KB | None | 0 0
  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.  
  11. namespace zadanie1
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.            
  19.             S.lCykli = 4;
  20.         } Sprawdz S = new Sprawdz();
  21.        public class Sprawdz:CheckBox
  22.         {
  23.             public int cykl=1;
  24.             public int lCykli { get; set; }
  25.             public Sprawdz() : base()
  26.             {
  27.                 lCykli = 4;
  28.             }
  29.             public virtual void ileCykli()
  30.             {  
  31.                 if (cykl==lCykli)
  32.                 {
  33.                     MessageBox.Show("Kliknąłeś za dużo razy!");
  34.                     cykl = 1;
  35.                 }
  36.                 else
  37.                     cykl+=1;
  38.             }          
  39.            
  40.         }
  41.  
  42.         private void checkBox1_CheckedChanged(object sender, EventArgs e)
  43.         {
  44.  
  45.             if (checkBox1.Checked == true || checkBox1.Checked == false)
  46.             {
  47.                 S.ileCykli();
  48.             }
  49.         }
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement