/* * * Need to be able to place objects in the control like the * following codes: * -- 0 1 2 3 -- d0 f0 12 ee d0 d4 40 ea d0 0c 40 ea d1 36 14 ec d1 c0 0c ec d0 cc 0c ea d0 f0 06 d2 d0 e4 0c ea d0 fc 0c ea d0 d8 0c ea d0 08 0c ea Where slot 0 holds the thyp of placement, slot 1 holds the Y coord, slot 2 the x coord and slot 3 holds the stance. d0 = Set Position From Hike d1 = Set Position From Middle of Field * */ public void AddGuy(int[] posData, string playerPosition) { if( posData != null && posData.Length > 3 && playerPosition != null ) { FieldNode node = new FieldNode(posData); node.Name = playerPosition; AddNode(node); } }
private void AddNode( FieldNode node) { m_FieldNodes.Add(node); Button b = new Button(); b.Tag = node; b.Text = node.Name; b.Size = new Size(10,10); b.BackColor = Color.Orange; switch( node.Cmd ) { case 0xd0: b.Location = new Point(node.X + this.Width/2 , node.Y); break; case 0xd1: b.Location = new Point(node.X + this.Width/2, node.Y + this.Height/2); break; } Controls.Add(b); Refresh(); }