public Board() { InitializeComponent(); this.Paint += Board_Paint; this.Resize += Board_Resize; this.Stylesheet = ((Form1)this.ParentForm).Stylesheet; this.ForeColor = Stylesheet.ForeColor; this.BackColor = Stylesheet.BackColor; tmrDraw = new Timer(); tmrDraw.Tick += tmrDraw_Tick; tmrDraw.Interval = 100; tmrDraw.Start(); this.MouseMove += Board_MouseMove; }
public Board(SpiderView spiderView) { this.SpiderView = spiderView; this.Stylesheet = (this.SpiderView).Stylesheet; InitializeComponent(); this.Paint += Board_Paint; this.Resize += Board_Resize; this.ForeColor = Stylesheet.ForeColor; this.BackColor = Stylesheet.BackColor; tmrDraw = new Timer(); tmrDraw.Tick += tmrDraw_Tick; tmrDraw.Interval = 100; tmrDraw.Start(); this.MouseMove += Board_MouseMove; }
public virtual void Draw(Graphics g) { if (this.Stylesheet == null) { this.Stylesheet = (Parent.Stylesheet != null ? Parent.Stylesheet : Board.Stylesheet); } foreach(Element elm in this.Children) { g.TranslateTransform(elm.X , elm.Y); if (elm.BackColor != null) { g.FillRectangle(new SolidBrush(elm.BackColor), new Rectangle(elm.X + this.Padding.Left, elm.Y + this.Padding.Top, elm.Width - this.Padding.Left * 2, elm.Height - this.Padding.Top * 2)); } elm.Draw(g); g.TranslateTransform(-elm.X, -elm.Y); } }