Advertisement
StevanovicMilan

Vežba 07, Zadatak 3

Dec 1st, 2017
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.26 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 Vezba_07_2017_Zad3
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         DateTime dt;
  16.         public Form1()
  17.         {
  18.             InitializeComponent();
  19.         }
  20.         // s tim sto mora na svaki radio button da se postavi da je ova funkcija handler
  21.  
  22.         private void radioButton1_CheckedChanged(object sender, EventArgs e)
  23.         {
  24.             if (radioButton1.Checked)
  25.             {
  26.                 label2.Text = radioButton1.Text;
  27.             }
  28.             if (radioButton2.Checked)
  29.             {
  30.                 label2.Text = radioButton2.Text;
  31.             }
  32.             if (radioButton3.Checked)
  33.             {
  34.                 label2.Text = radioButton3.Text;
  35.             }
  36.             if (radioButton4.Checked)
  37.             {
  38.                 label2.Text = radioButton4.Text;
  39.             }
  40.             if (radioButton5.Checked)
  41.             {
  42.                 label2.Text = radioButton5.Text;
  43.             }
  44.             if (radioButton6.Checked)
  45.             {
  46.                 label2.Text = radioButton6.Text;
  47.             }
  48.             if (radioButton7.Checked)
  49.             {
  50.                 label2.Text = radioButton7.Text;
  51.             }
  52.             if (radioButton8.Checked)
  53.             {
  54.                 label2.Text = radioButton8.Text;
  55.             }
  56.             if (radioButton9.Checked)
  57.             {
  58.                 label2.Text = radioButton9.Text;
  59.             }
  60.         }
  61.         private void Form1_Load(object sender, EventArgs e)
  62.         {
  63.             timer1.Start();
  64.             dt = DateTime.Now;
  65.         }
  66.  
  67.         private void timer1_Tick(object sender, EventArgs e)
  68.         {
  69.             label3.Text = DateTime.Now.ToLongTimeString();
  70.             if (radioButton1.Checked)
  71.             {
  72.                 label4.Text = DateTime.Now.AddHours(-10).ToLongTimeString();
  73.             }
  74.             else if (radioButton2.Checked)
  75.             {
  76.                 label4.Text = DateTime.Now.AddHours(-7).ToLongTimeString();
  77.             }
  78.             else if (radioButton3.Checked)
  79.             {
  80.                 label4.Text = DateTime.Now.AddHours(-1).ToLongTimeString();
  81.             }
  82.             else if (radioButton4.Checked)
  83.             {
  84.                 label4.Text = DateTime.Now.AddHours(0).ToLongTimeString();
  85.             }
  86.             else if (radioButton5.Checked)
  87.             {
  88.                 label4.Text = DateTime.Now.AddHours(0).ToLongTimeString();
  89.             }
  90.             else if (radioButton6.Checked)
  91.             {
  92.                 label4.Text = DateTime.Now.AddHours(+2).ToLongTimeString();
  93.             }
  94.             else if (radioButton7.Checked)
  95.             {
  96.                 label4.Text = DateTime.Now.AddHours(+6).ToLongTimeString();
  97.             }
  98.             else if (radioButton8.Checked)
  99.             {
  100.                 label4.Text = DateTime.Now.AddHours(+7).ToLongTimeString();
  101.             }
  102.             else if (radioButton9.Checked)
  103.             {
  104.                 label4.Text = DateTime.Now.AddHours(+9).ToLongTimeString();
  105.             }
  106.              
  107.         }
  108.     }
  109. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement