/// <summary> /// Создает форму в которую будет происходить рендеринг. На ней нужно обязательно вызвать метод Dispose. Форма закрываеть при нажатии Esc. Форма создаеться по размеру экрана и в его центре. /// </summary> /// <param name="Text">Текст в заголовке формы</param> /// <param name="IconFile">Файл в формает .ico для инконки в заголовке формы</param> /// <returns></returns> public static SharpDX.Windows.RenderForm GetRenderForm(string Text, string iconFile = null) { if (!SharpDX.Direct3D11.Device.IsSupportedFeatureLevel(SharpDX.Direct3D.FeatureLevel.Level_11_0)) { System.Windows.Forms.MessageBox.Show("Для запуска нужен DirectX 11 ОБЯЗАТЕЛЬНО!"); return(null); } #if DEBUG SharpDX.Configuration.EnableObjectTracking = true; #endif var _renderForm = new SharpDX.Windows.RenderForm(Text) { AllowUserResizing = false, IsFullscreen = true, StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen, ClientSize = new System.Drawing.Size(System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height), FormBorderStyle = System.Windows.Forms.FormBorderStyle.None, Icon = iconFile != null ? new System.Drawing.Icon(iconFile) : new System.Drawing.Icon("LogoVW.ico") }; _renderForm.Shown += (sender, e) => { _renderForm.Activate(); }; _renderForm.KeyDown += (sender, e) => { if (e.KeyCode == System.Windows.Forms.Keys.Escape) { _renderForm.Close(); } }; return(_renderForm); }