Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Drawing;
- using System.Windows.Forms;
- using thesis.core;
- using System.Collections.Generic;
- namespace thesis.visualisation
- {
- public class LevelViewForm : Form
- {
- private CellularLevel level;
- private List<FloorDrawPanel> renderingPanels = new List<FloorDrawPanel>();
- private FlowLayoutPanel layoutPanel = new FlowLayoutPanel();
- public LevelViewForm (CellularLevel level)
- {
- this.level = level;
- this.layoutPanel.SuspendLayout();
- this.SuspendLayout();
- this.ClientSize = new Size(1024,768);
- this.layoutPanel.WrapContents = true;
- this.layoutPanel.FlowDirection = FlowDirection.LeftToRight;
- this.layoutPanel.Location = new System.Drawing.Point(0, 0);
- for (int i = level.z - 1; i >= 0; --i) {
- Console.WriteLine("level {0}",i);
- FloorDrawPanel fp = new FloorDrawPanel(level,i);
- fp.Location = new Point(100 * i,100*i);
- fp.TabIndex = i;
- this.renderingPanels.Add(fp);
- this.layoutPanel.Controls.Add(fp);
- }
- this.layoutPanel.Controls.Add(new FloorDrawPanel(level,1));
- this.Controls.Add(layoutPanel);
- this.layoutPanel.ResumeLayout(false);
- this.ResumeLayout(false);
- }
- protected override void OnPaint (PaintEventArgs e)
- {
- Console.WriteLine("base paint");
- foreach (FloorDrawPanel pan in renderingPanels) {
- pan.Invalidate();
- }
- base.OnPaint (e);
- }
- }
- }
- using System;
- using System.Drawing;
- using System.Windows.Forms;
- using thesis.core;
- namespace thesis.visualisation
- {
- public class FloorDrawPanel : Panel
- {
- private int z;
- private CellularLevel level;
- public FloorDrawPanel (CellularLevel level,int z)
- {
- this.level = level;
- this.z = z;
- this.Size = new Size(100,100);
- this.ClientSize = new Size(100,100);
- }
- protected override void OnPaint (PaintEventArgs e)
- {
- Console.WriteLine("painting {0}",z.ToString());
- e.Graphics.DrawString(z.ToString(),new Font(FontFamily.GenericSansSerif,10.5f),new SolidBrush(Color.Black),10 * z,0);
- //e.Graphics.DrawLine(new Pen(col,10),new Point(0,0),new Point(100,100));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement