protected override void OnCreate(ref CreateWindowPacket packet) { this.m_textBox1 = StaticBox.Create(hParent: this.Handle, styles: WindowStyles.WS_CHILD | WindowStyles.WS_VISIBLE, exStyles: 0); // You can use this to create the static box like this as well. // But there's rarely any performance benefit in doing so, and // this doesn't have a WindowProc that's connected. this.m_textBox2 = WindowFactory.CreateExternalWindow("static", hParent: this.Handle, styles: WindowStyles.WS_CHILD | WindowStyles.WS_VISIBLE, exStyles: 0); this.m_layout.ClientArea = this.GetClientRect(); this.m_layout.Margin = new Rectangle(10, 10, 10, 10); this.m_layout.Children.Add(this.m_textBox1); this.m_layout.Children.Add(this.m_textBox2); this.m_layout.PerformLayout(); var r = new Random(); this.m_task = Task.Run(() => { while (this.m_times < Iterations) { this.m_times++; this.SetPosition(50, 50, 1200 - r.Next(0, 1100), 900 - r.Next(0, 800)); } this.m_endTime = DateTime.Now; this.m_done = true; this.SetPosition(50, 50, 700, 500); }); this.m_startTime = DateTime.Now; base.OnCreate(ref packet); }