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 Hanoitornyai { public partial class Form1 : Form { public Rud[] rudak; private Color[] kszinek = {Color.Red, Color.Orange, Color.Yellow, Color.Aqua, Color.Blue}; public Form1() { InitializeComponent(); rudak = new Rud[3]; for (int i = 0; i < rudak.Length; i++) { rudak[i] = new Rud(Color.Black); } for (int i = 0;i < kszinek.Length;i++) { rudak[0].korongok.Add(new Korong(kszinek[i])); } rudakPozicio(); } private void Form1_ResizeEnd(object sender, EventArgs e) { //Initialize(); } private void rudakPozicio() { float psz = JatekPanel.Width; float pm = JatekPanel.Height; float rm = pm * 0.75f; float rsz = rm / 12; float rkoz = (psz - (3 * rsz)) / 4; for (int i = 0; i < rudak.Length; i++) { rudak[i].magassag = rm; rudak[i].szelesseg = rsz; rudak[i].y = pm / 4; rudak[i].x = (rkoz*(i+1))+(i*rsz); } } /* public void Initialize() { Graphics g = JatekPanel.CreateGraphics(); g.Clear(Color.White); Pen toll = new Pen(Color.Black); Brush brush = new SolidBrush(Color.Black); int egynegyed = JatekPanel.Width / 4; int ketharmad = (JatekPanel.Height / 3) * 2; g.FillRectangle(brush, new Rectangle(egynegyed - 10, JatekPanel.Height - ketharmad, 20, ketharmad)); g.FillRectangle(brush, new Rectangle(egynegyed * 2 - 10, JatekPanel.Height - ketharmad, 20, ketharmad)); g.FillRectangle(brush, new Rectangle(egynegyed * 3 - 10, JatekPanel.Height - ketharmad, 20, ketharmad)); g.FillRectangle(brush, new Rectangle(0, JatekPanel.Height - 20, JatekPanel.Width, 20)); }*/ private void Paint(object sender, PaintEventArgs e) { Graphics g = JatekPanel.CreateGraphics(); Brush brush = new SolidBrush(rudak[0].szin); for (int i = 0; i < rudak.Length; i++) { g.FillRectangle(brush, rudak[i].x, rudak[i].y, rudak[i].szelesseg, rudak[i].magassag); } } } }