public D3DSettings settings; // Potential new D3D settings public D3DSettingsForm(D3DEnumeration enumerationParam, D3DSettings settingsParam) { enumeration = enumerationParam; settings = settingsParam.Clone(); // Required for Windows Form Designer support InitializeComponent(); // Fill adapter combo box. Updating the selected adapter will trigger // updates of the rest of the dialog. foreach (GraphicsAdapterInfo adapterInfo in enumeration.AdapterInfoList) { adapterComboBox.Items.Add(adapterInfo); if (adapterInfo.AdapterOrdinal == settings.AdapterOrdinal) { adapterComboBox.SelectedItem = adapterInfo; } } if (adapterComboBox.SelectedItem == null && adapterComboBox.Items.Count > 0) { adapterComboBox.SelectedIndex = 0; } }
/// <summary> /// Displays a dialog so the user can select a new adapter, device, or /// display mode, and then recreates the 3D environment if needed /// </summary> private void DoSelectNewDevice() { // Can't display dialogs in fullscreen mode //if (windowed == false) //{ // try // { // ToggleFullscreen(); // } // catch // { // HandleSampleException(new ResetFailedException(), ApplicationMessage.ApplicationMustExit); // return; // } //} // Make sure the main form is in the background RenderTarget.SendToBack(); D3DSettingsForm settingsForm = new D3DSettingsForm(enumerationSettings, graphicsSettings); System.Windows.Forms.DialogResult result = settingsForm.ShowDialog(null); if (result != System.Windows.Forms.DialogResult.OK) { return; } graphicsSettings = settingsForm.settings; //windowed = graphicsSettings.IsWindowed; // Release display objects, so a new device can be created device.Dispose(); device = null; // Inform the display class of the change. It will internally // re-create valid surfaces, a d3ddevice, etc. InitializeEnvironment(); }