public void Draw() { this.BackColor = Color.Black; Controls.Clear(); // draw sim gallery panel = new BufferedFlowLayoutPanel(); panel.AutoScroll = false; Padding = new Padding(35); lbl_selectsim = new Label { Text = "Select simulator" }; lbl_selectsim.Font = new Font("Arial", 32.0f, FontStyle.Italic | FontStyle.Bold); lbl_selectsim.ForeColor = Color.White; lbl_selectsim.TextAlign = ContentAlignment.MiddleCenter; panel.Controls.Add(lbl_selectsim); foreach (ISimulator sim in Telemetry.m.Sims.Sims) { bool validSim = (sim.Garage == null || sim.Garage.Available == false || !Directory.Exists(sim.Session.GameDirectory)); if (File.Exists("Simulators/" + sim.ProcessName + ".png")) { ucResizableImage pb = new ucResizableImage("Simulators/" + sim.ProcessName + ".png"); pb.Margin = new Padding(10); pb.Name = sim.Name; if (validSim) { pb.Disabled = true; } else { pb.Cursor = Cursors.Hand; pb.Click += new EventHandler(pb_Click); } pb.Crop(213, 120); panel.Controls.Add(pb); } else { Label l = new Label {Text = sim.Name}; l.Size = new Size(213, 120); l.Font = new Font("Tahoma", 24.0f, FontStyle.Bold); l.TextAlign = ContentAlignment.MiddleCenter; l.Name = sim.Name; if (validSim) { l.ForeColor = Color.Gray; } else { l.ForeColor = Color.White; l.Click += new EventHandler(pb_Click); l.Cursor = Cursors.Hand; } panel.Controls.Add(l); } } Controls.Add(panel); }
public ucSelectTrackCars() { InitializeComponent(); this.Padding = new Padding(35, 85, 35, 35); panel = new BufferedFlowLayoutPanel(); t = new Label { Text = "Select mod/track" }; t.Font = new Font("Arial", 32.0f, FontStyle.Italic | FontStyle.Bold); t.ForeColor = Color.White; t.TextAlign = ContentAlignment.MiddleCenter; txt_loading = new Label(); txt_loading.Text = "Loading cars & tracks..."; txt_loading.Dock = DockStyle.Fill; txt_loading.TextAlign = ContentAlignment.MiddleCenter; txt_loading.ForeColor = Color.White; txt_loading.Font = new Font("Tahoma", 24.0f, FontStyle.Bold); SetStyle(ControlStyles.DoubleBuffer | ControlStyles.AllPaintingInWmPaint, true); }
public void Draw() { this.BackColor = Color.Black; Controls.Clear(); // draw sim gallery panel = new BufferedFlowLayoutPanel(); panel.AutoScroll = false; Padding = new Padding(35); lbl_selectsim = new Label { Text = "Select simulator" }; lbl_selectsim.Font = new Font("Arial", 32.0f, FontStyle.Italic | FontStyle.Bold); lbl_selectsim.ForeColor = Color.White; lbl_selectsim.TextAlign = ContentAlignment.MiddleCenter; panel.Controls.Add(lbl_selectsim); foreach (ISimulator sim in Telemetry.m.Sims.Sims) { bool validSim = (sim.Garage == null || sim.Garage.Available == false || !Directory.Exists(sim.Session.GameDirectory)); if (File.Exists("Simulators/" + sim.ProcessName + ".png")) { ucResizableImage pb = new ucResizableImage("Simulators/" + sim.ProcessName + ".png"); pb.Margin = new Padding(10); pb.Name = sim.Name; if (validSim) { pb.Disabled = true; } else { pb.Cursor = Cursors.Hand; pb.Click += new EventHandler(pb_Click); } pb.Crop(213, 120); panel.Controls.Add(pb); } else { Label l = new Label { Text = sim.Name }; l.Size = new Size(213, 120); l.Font = new Font("Tahoma", 24.0f, FontStyle.Bold); l.TextAlign = ContentAlignment.MiddleCenter; l.Name = sim.Name; if (validSim) { l.ForeColor = Color.Gray; } else { l.ForeColor = Color.White; l.Click += new EventHandler(pb_Click); l.Cursor = Cursors.Hand; } panel.Controls.Add(l); } } Controls.Add(panel); }