Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        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;
        }