1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231:
| using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;
namespace Aufgabe_1 { public partial class Form1 : Form { Timer Timer_1 = new Timer(); Timer Timer_2 = new Timer(); Timer Timer_3 = new Timer(); Timer Timer_4 = new Timer();
public int UTC_1 { get { return this.UTC_1; } set { this.UTC_1 = value; } } public int UTC_2 { get { return this.UTC_2; } set { this.UTC_1 = value; } } public int UTC_3 { get { return this.UTC_3; } set { this.UTC_1 = value; } } public int UTC_4 { get { return this.UTC_4; } set { this.UTC_1 = value; } } public Form1() { InitializeComponent(); InitializeTimer(); this.Timer_1.Start(); this.Timer_2.Start(); this.Timer_3.Start(); this.Timer_4.Start(); }
public void InitializeTimer() { this.Timer_1.Interval = 1000; this.Timer_1.Tick += new EventHandler(Timer_1_Tick);
this.Timer_2.Interval = 1000; this.Timer_2.Tick += new EventHandler(Timer_2_Tick);
this.Timer_3.Interval = 1000; this.Timer_3.Tick += new EventHandler(Timer_3_Tick);
this.Timer_4.Interval = 1000; this.Timer_4.Tick += new EventHandler(Timer_4_Tick); }
private void Timer_1_Tick(object sender, EventArgs e) { this.Zeit_Neu.Text = string.Format("{0:00}:{1:00}:{2:00}", (DateTime.Now.Hour) + UTC_1, DateTime.Now.Minute, DateTime.Now.Second); this.Invalidate(); }
private void Timer_2_Tick(object sender, EventArgs e) { this.Zeit_Chi.Text = string.Format("{0:00}:{1:00}:{2:00}", (DateTime.Now.Hour) + UTC_2, DateTime.Now.Minute, DateTime.Now.Second); this.Invalidate(); }
private void Timer_3_Tick(object sender, EventArgs e) { this.Zeit_3.Text = string.Format("{0:00}:{1:00}:{2:00}", (DateTime.Now.Hour) + UTC_3, DateTime.Now.Minute, DateTime.Now.Second);
this.Invalidate(); }
private void Timer_4_Tick(object sender, EventArgs e) { this.Zeit_4.Text = string.Format("{0:00}:{1:00}:{2:00}", (DateTime.Now.Hour) + UTC_4, DateTime.Now.Minute, DateTime.Now.Second);
this.Invalidate(); }
private void Form1_Paint(object sender, PaintEventArgs e) { float SekWinkel = DateTime.Now.Second * 6; float MinWinkel = DateTime.Now.Minute * 6; float StdWinkel1 = (DateTime.Now.Hour + ((DateTime.Now.Minute / 60)) * 30 ); float StdWinkel2 = (DateTime.Now.Hour + ((DateTime.Now.Minute / 60)) * 30 ); float StdWinkel3 = (DateTime.Now.Hour + ((DateTime.Now.Minute / 60)) * 30 ); float StdWinkel4 = (DateTime.Now.Hour + ((DateTime.Now.Minute / 60)) * 30 );
double SekRad = SekWinkel * Math.PI / 180; double MinRad = MinWinkel * Math.PI / 180; double StdRad1 = StdWinkel1 * Math.PI / 180; double StdRad2 = StdWinkel2 * Math.PI / 180; double StdRad3 = StdWinkel3 * Math.PI / 180; double StdRad4 = StdWinkel4 * Math.PI / 180;
float xSek1 = 135 + (float)(0.9 * 100 * Math.Sin(SekRad)); float xSek2 = 435 + (float)(0.9 * 100 * Math.Sin(SekRad)); float xSek3 = 735 + (float)(0.9 * 100 * Math.Sin(SekRad)); float xSek4 = 1035 + (float)(0.9 * 100 * Math.Sin(SekRad)); float ySek = 185 - (float)(0.9 * 100 * Math.Cos(SekRad)); float xMin1 = 135 + (float)(0.8 * 100 * Math.Sin(MinRad)); float xMin2 = 435 + (float)(0.8 * 100 * Math.Sin(MinRad)); float xMin3 = 735 + (float)(0.8 * 100 * Math.Sin(MinRad)); float xMin4 = 1035 + (float)(0.8 * 100 * Math.Sin(MinRad)); float yMin = 185 - (float)(0.8 * 100 * Math.Sin(MinRad)); float xStd1 = 135 + (float)(0.5 * 100 * Math.Sin(StdRad1)); float xStd2 = 435 + (float)(0.5 * 100 * Math.Sin(StdRad2)); float xStd3 = 735 + (float)(0.5 * 100 * Math.Sin(StdRad3)); float xStd4 = 1035 + (float)(0.5 * 100 * Math.Sin(StdRad4)); float yStd1 = 185 - (float)(0.5 * 100 * Math.Sin(StdRad1)); float yStd2 = 185 - (float)(0.5 * 100 * Math.Sin(StdRad2)); float yStd3 = 185 - (float)(0.5 * 100 * Math.Sin(StdRad3)); float yStd4 = 185 - (float)(0.5 * 100 * Math.Sin(StdRad4));
Graphics Cl = CreateGraphics(); Cl.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; Cl.DrawEllipse(Pens.Gray, 35, 85, 200, 200); Cl.DrawEllipse(Pens.Gray, 335, 85, 200, 200); Cl.DrawEllipse(Pens.Gray, 635, 85, 200, 200); Cl.DrawEllipse(Pens.Gray, 935, 85, 200, 200);
using (Pen pen = new Pen(Color.Black, 8)) { e.Graphics.DrawLine(pen, 135, 185, xStd1, yStd1); } using (Pen pen = new Pen(Color.Black, 6)) { e.Graphics.DrawLine(pen, 135, 185, xMin1, yMin); } using (Pen pen = new Pen(Color.Red, 4)) { e.Graphics.DrawLine(pen, 135, 185, xSek1, ySek); } using (Brush brush = new SolidBrush(Color.Red)) { e.Graphics.FillEllipse(brush, 135 - 6, 185 - 6, 2 * 6, 2 * 6); } using (Brush brush = new SolidBrush(Color.Black)) { e.Graphics.FillEllipse(brush, 135 - 2, 185 - 2, 2 * 2, 2 * 2); }
using (Pen pen = new Pen(Color.Black, 8)) { e.Graphics.DrawLine(pen, 435, 185, xStd2, yStd2); } using (Pen pen = new Pen(Color.Black, 6)) { e.Graphics.DrawLine(pen, 435, 185, xMin2, yMin); } using (Pen pen = new Pen(Color.Red, 4)) { e.Graphics.DrawLine(pen, 435, 185, xSek2, ySek); } using (Brush brush = new SolidBrush(Color.Red)) { e.Graphics.FillEllipse(brush, 435 - 6, 185 - 6, 2 * 6, 2 * 6); } using (Brush brush = new SolidBrush(Color.Black)) { e.Graphics.FillEllipse(brush, 435 - 2, 185 - 2, 2 * 2, 2 * 2); }
using (Pen pen = new Pen(Color.Black, 8)) { e.Graphics.DrawLine(pen, 735, 185, xStd3, yStd1); } using (Pen pen = new Pen(Color.Black, 6)) { e.Graphics.DrawLine(pen, 735, 185, xMin3, yMin); } using (Pen pen = new Pen(Color.Red, 4)) { e.Graphics.DrawLine(pen, 735, 185, xSek3, ySek); } using (Brush brush = new SolidBrush(Color.Red)) { e.Graphics.FillEllipse(brush, 735 - 6, 185 - 6, 2 * 6, 2 * 6); } using (Brush brush = new SolidBrush(Color.Black)) { e.Graphics.FillEllipse(brush, 135 - 2, 185 - 2, 2 * 2, 2 * 2); }
using (Pen pen = new Pen(Color.Black, 8)) { e.Graphics.DrawLine(pen, 1035, 185, xStd4, yStd1); } using (Pen pen = new Pen(Color.Black, 6)) { e.Graphics.DrawLine(pen, 1035, 185, xMin4, yMin); } using (Pen pen = new Pen(Color.Red, 4)) { e.Graphics.DrawLine(pen, 1035, 185, xSek4, ySek); } using (Brush brush = new SolidBrush(Color.Red)) { e.Graphics.FillEllipse(brush, 1035 - 6, 185 - 6, 2 * 6, 2 * 6); } using (Brush brush = new SolidBrush(Color.Black)) { e.Graphics.FillEllipse(brush, 1035 - 2, 185 - 2, 2 * 2, 2 * 2); } } } } |