protected FormWrapperBase(BaseRenderer renderer, string title, int width, int height) { if (StopCurrent()) { throw new Exception("Can’t have two renderers running at the same time"); } _current = this; _title = title; Form = new RenderForm(title) { ClientSize = new Size(width, height), StartPosition = FormStartPosition.CenterScreen }; Renderer = renderer; Renderer.Initialize(Form.Handle); Renderer.SetAssociatedWindow(Form); UpdateSize(); Form.UserResized += OnResize; Form.KeyDown += OnKeyDown; Form.KeyUp += OnKeyUp; Form.GotFocus += OnGotFocus; Form.LostFocus += OnLostFocus; renderer.Tick += OnTick; }
public BaseFormWrapper(BaseRenderer renderer, string title, int width, int height) { _title = title; Form = new RenderForm(title) { Width = width, Height = height, StartPosition = FormStartPosition.CenterScreen }; Renderer = renderer; Renderer.Initialize(Form.Handle); Renderer.SetAssociatedWindow(Form); Renderer.Width = Form.ClientSize.Width; Renderer.Height = Form.ClientSize.Height; Form.UserResized += OnResize; Form.KeyDown += OnKeyDown; Form.KeyUp += OnKeyUp; Form.GotFocus += OnGotFocus; Form.LostFocus += OnLostFocus; renderer.Tick += OnTick; }