⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 d3dsettingsform.cs

📁 Game Engine Desing Direct X and C#.rar
💻 CS
📖 第 1 页 / 共 3 页
字号:
		// 
		// cancelButton
		// 
		this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
		this.cancelButton.Location = new System.Drawing.Point(248, 464);
		this.cancelButton.Name = "cancelButton";
		this.cancelButton.TabIndex = 4;
		this.cancelButton.Text = "Cancel";
		// 
		// otherSettingsGroupBox
		// 
		this.otherSettingsGroupBox.Controls.AddRange(new System.Windows.Forms.Control[] {
																							this.multisampleQualityComboBox,
																							this.multisampleQualityLabel,
																							this.multisampleComboBox,
																							this.backBufferFormatComboBox,
																							this.multisampleLabel,
																							this.depthStencilBufferLabel,
																							this.backBufferFormatLabel,
																							this.depthStencilBufferComboBox,
																							this.vertexProcComboBox,
																							this.vertexProcLabel,
																							this.presentIntervalComboBox,
																							this.presentIntervalLabel});
		this.otherSettingsGroupBox.Location = new System.Drawing.Point(16, 264);
		this.otherSettingsGroupBox.Name = "otherSettingsGroupBox";
		this.otherSettingsGroupBox.Size = new System.Drawing.Size(400, 176);
		this.otherSettingsGroupBox.TabIndex = 2;
		this.otherSettingsGroupBox.TabStop = false;
		this.otherSettingsGroupBox.Text = "Device settings";
		// 
		// multisampleQualityComboBox
		// 
		this.multisampleQualityComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.multisampleQualityComboBox.DropDownWidth = 144;
		this.multisampleQualityComboBox.Location = new System.Drawing.Point(160, 96);
		this.multisampleQualityComboBox.Name = "multisampleQualityComboBox";
		this.multisampleQualityComboBox.Size = new System.Drawing.Size(232, 21);
		this.multisampleQualityComboBox.TabIndex = 7;
		this.multisampleQualityComboBox.SelectedIndexChanged += new System.EventHandler(this.MultisampleQualityChanged);
		// 
		// multisampleQualityLabel
		// 
		this.multisampleQualityLabel.Location = new System.Drawing.Point(8, 96);
		this.multisampleQualityLabel.Name = "multisampleQualityLabel";
		this.multisampleQualityLabel.Size = new System.Drawing.Size(152, 23);
		this.multisampleQualityLabel.TabIndex = 6;
		this.multisampleQualityLabel.Text = "Multisample &Quality:";
		// 
		// multisampleComboBox
		// 
		this.multisampleComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.multisampleComboBox.DropDownWidth = 144;
		this.multisampleComboBox.Location = new System.Drawing.Point(160, 72);
		this.multisampleComboBox.Name = "multisampleComboBox";
		this.multisampleComboBox.Size = new System.Drawing.Size(232, 21);
		this.multisampleComboBox.TabIndex = 5;
		this.multisampleComboBox.SelectedIndexChanged += new System.EventHandler(this.MultisampleTypeChanged);
		// 
		// backBufferFormatComboBox
		// 
		this.backBufferFormatComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.backBufferFormatComboBox.DropDownWidth = 144;
		this.backBufferFormatComboBox.Location = new System.Drawing.Point(160, 24);
		this.backBufferFormatComboBox.Name = "backBufferFormatComboBox";
		this.backBufferFormatComboBox.Size = new System.Drawing.Size(232, 21);
		this.backBufferFormatComboBox.TabIndex = 1;
		this.backBufferFormatComboBox.SelectedIndexChanged += new System.EventHandler(this.BackBufferFormatChanged);
		// 
		// multisampleLabel
		// 
		this.multisampleLabel.Location = new System.Drawing.Point(8, 72);
		this.multisampleLabel.Name = "multisampleLabel";
		this.multisampleLabel.Size = new System.Drawing.Size(152, 23);
		this.multisampleLabel.TabIndex = 4;
		this.multisampleLabel.Text = "&Multisample Type:";
		// 
		// depthStencilBufferLabel
		// 
		this.depthStencilBufferLabel.Location = new System.Drawing.Point(8, 48);
		this.depthStencilBufferLabel.Name = "depthStencilBufferLabel";
		this.depthStencilBufferLabel.Size = new System.Drawing.Size(152, 23);
		this.depthStencilBufferLabel.TabIndex = 2;
		this.depthStencilBufferLabel.Text = "De&pth/Stencil Buffer Format:";
		// 
		// backBufferFormatLabel
		// 
		this.backBufferFormatLabel.Location = new System.Drawing.Point(8, 24);
		this.backBufferFormatLabel.Name = "backBufferFormatLabel";
		this.backBufferFormatLabel.Size = new System.Drawing.Size(152, 23);
		this.backBufferFormatLabel.TabIndex = 0;
		this.backBufferFormatLabel.Text = "&Back Buffer Format:";
		// 
		// depthStencilBufferComboBox
		// 
		this.depthStencilBufferComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.depthStencilBufferComboBox.DropDownWidth = 144;
		this.depthStencilBufferComboBox.Location = new System.Drawing.Point(160, 48);
		this.depthStencilBufferComboBox.Name = "depthStencilBufferComboBox";
		this.depthStencilBufferComboBox.Size = new System.Drawing.Size(232, 21);
		this.depthStencilBufferComboBox.TabIndex = 3;
		this.depthStencilBufferComboBox.SelectedIndexChanged += new System.EventHandler(this.DepthStencilBufferFormatChanged);
		// 
		// vertexProcComboBox
		// 
		this.vertexProcComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.vertexProcComboBox.DropDownWidth = 121;
		this.vertexProcComboBox.Location = new System.Drawing.Point(160, 120);
		this.vertexProcComboBox.Name = "vertexProcComboBox";
		this.vertexProcComboBox.Size = new System.Drawing.Size(232, 21);
		this.vertexProcComboBox.TabIndex = 9;
		this.vertexProcComboBox.SelectedIndexChanged += new System.EventHandler(this.VertexProcessingChanged);
		// 
		// vertexProcLabel
		// 
		this.vertexProcLabel.Location = new System.Drawing.Point(8, 120);
		this.vertexProcLabel.Name = "vertexProcLabel";
		this.vertexProcLabel.Size = new System.Drawing.Size(152, 23);
		this.vertexProcLabel.TabIndex = 8;
		this.vertexProcLabel.Text = "&Vertex Processing:";
		// 
		// presentIntervalComboBox
		// 
		this.presentIntervalComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.presentIntervalComboBox.DropDownWidth = 121;
		this.presentIntervalComboBox.Location = new System.Drawing.Point(160, 144);
		this.presentIntervalComboBox.Name = "presentIntervalComboBox";
		this.presentIntervalComboBox.Size = new System.Drawing.Size(232, 21);
		this.presentIntervalComboBox.TabIndex = 11;
		this.presentIntervalComboBox.SelectedValueChanged += new System.EventHandler(this.PresentIntervalChanged);
		// 
		// presentIntervalLabel
		// 
		this.presentIntervalLabel.Location = new System.Drawing.Point(8, 144);
		this.presentIntervalLabel.Name = "presentIntervalLabel";
		this.presentIntervalLabel.Size = new System.Drawing.Size(152, 23);
		this.presentIntervalLabel.TabIndex = 10;
		this.presentIntervalLabel.Text = "Present &Interval:";
		// 
		// resolutionComboBox
		// 
		this.resolutionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.resolutionComboBox.DropDownWidth = 144;
		this.resolutionComboBox.Location = new System.Drawing.Point(161, 94);
		this.resolutionComboBox.MaxDropDownItems = 14;
		this.resolutionComboBox.Name = "resolutionComboBox";
		this.resolutionComboBox.Size = new System.Drawing.Size(232, 21);
		this.resolutionComboBox.TabIndex = 5;
		this.resolutionComboBox.SelectedIndexChanged += new System.EventHandler(this.ResolutionChanged);
		// 
		// windowedRadioButton
		// 
		this.windowedRadioButton.Location = new System.Drawing.Point(9, 14);
		this.windowedRadioButton.Name = "windowedRadioButton";
		this.windowedRadioButton.Size = new System.Drawing.Size(152, 24);
		this.windowedRadioButton.TabIndex = 0;
		this.windowedRadioButton.Text = "&Windowed";
		this.windowedRadioButton.CheckedChanged += new System.EventHandler(this.WindowedFullscreenChanged);
		// 
		// resolutionLabel
		// 
		this.resolutionLabel.Location = new System.Drawing.Point(8, 94);
		this.resolutionLabel.Name = "resolutionLabel";
		this.resolutionLabel.Size = new System.Drawing.Size(152, 23);
		this.resolutionLabel.TabIndex = 4;
		this.resolutionLabel.Text = "&Resolution:";
		// 
		// refreshRateComboBox
		// 
		this.refreshRateComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.refreshRateComboBox.DropDownWidth = 144;
		this.refreshRateComboBox.Location = new System.Drawing.Point(161, 118);
		this.refreshRateComboBox.MaxDropDownItems = 14;
		this.refreshRateComboBox.Name = "refreshRateComboBox";
		this.refreshRateComboBox.Size = new System.Drawing.Size(232, 21);
		this.refreshRateComboBox.TabIndex = 7;
		this.refreshRateComboBox.SelectedIndexChanged += new System.EventHandler(this.RefreshRateChanged);
		// 
		// adapterFormatLabel
		// 
		this.adapterFormatLabel.Location = new System.Drawing.Point(8, 72);
		this.adapterFormatLabel.Name = "adapterFormatLabel";
		this.adapterFormatLabel.Size = new System.Drawing.Size(152, 23);
		this.adapterFormatLabel.TabIndex = 2;
		this.adapterFormatLabel.Text = "Adapter F&ormat:";
		// 
		// refreshRateLabel
		// 
		this.refreshRateLabel.Location = new System.Drawing.Point(8, 118);
		this.refreshRateLabel.Name = "refreshRateLabel";
		this.refreshRateLabel.Size = new System.Drawing.Size(152, 23);
		this.refreshRateLabel.TabIndex = 6;
		this.refreshRateLabel.Text = "R&efresh Rate:";
		// 
		// okButton
		// 
		this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
		this.okButton.Location = new System.Drawing.Point(112, 464);
		this.okButton.Name = "okButton";
		this.okButton.TabIndex = 3;
		this.okButton.Text = "OK";
		// 
		// modeSettingsGroupBox
		// 
		this.modeSettingsGroupBox.Controls.AddRange(new System.Windows.Forms.Control[] {
																						   this.adapterFormatLabel,
																						   this.refreshRateLabel,
																						   this.resolutionComboBox,
																						   this.adapterFormatComboBox,
																						   this.resolutionLabel,
																						   this.refreshRateComboBox,
																						   this.windowedRadioButton,
																						   this.fullscreenRadioButton});
		this.modeSettingsGroupBox.Location = new System.Drawing.Point(16, 96);
		this.modeSettingsGroupBox.Name = "modeSettingsGroupBox";
		this.modeSettingsGroupBox.Size = new System.Drawing.Size(400, 160);
		this.modeSettingsGroupBox.TabIndex = 1;
		this.modeSettingsGroupBox.TabStop = false;
		this.modeSettingsGroupBox.Text = "Display mode settings";
		// 
		// adapterFormatComboBox
		// 
		this.adapterFormatComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.adapterFormatComboBox.DropDownWidth = 121;
		this.adapterFormatComboBox.Location = new System.Drawing.Point(161, 70);
		this.adapterFormatComboBox.MaxDropDownItems = 14;
		this.adapterFormatComboBox.Name = "adapterFormatComboBox";
		this.adapterFormatComboBox.Size = new System.Drawing.Size(232, 21);
		this.adapterFormatComboBox.TabIndex = 3;
		this.adapterFormatComboBox.SelectedValueChanged += new System.EventHandler(this.AdapterFormatChanged);
		// 
		// D3DSettingsForm
		// 
		this.AcceptButton = this.okButton;
		this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
		this.CancelButton = this.cancelButton;
		this.ClientSize = new System.Drawing.Size(438, 512);
		this.Controls.AddRange(new System.Windows.Forms.Control[] {
																	  this.cancelButton,
																	  this.okButton,
																	  this.adapterDeviceGroupBox,
																	  this.modeSettingsGroupBox,
																	  this.otherSettingsGroupBox});
		this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
		this.MaximizeBox = false;
		this.Name = "D3DSettingsForm";
		this.Text = "Direct3D Settings";
		this.adapterDeviceGroupBox.ResumeLayout(false);
		this.otherSettingsGroupBox.ResumeLayout(false);
		this.modeSettingsGroupBox.ResumeLayout(false);
		this.ResumeLayout(false);

	}
	#endregion

	/// <summary>
	/// Respond to a change of selected adapter by rebuilding the device 
	/// list.  Updating the selected device will trigger updates of the 
	/// rest of the dialog.
	/// </summary>
	private void AdapterChanged(object sender, System.EventArgs e)
	{
		GraphicsAdapterInfo adapterInfo = (GraphicsAdapterInfo)adapterComboBox.SelectedItem;
		settings.AdapterInfo = adapterInfo;

		// Update device combo box
		deviceComboBox.Items.Clear();
		foreach (GraphicsDeviceInfo deviceInfo in adapterInfo.DeviceInfoList)
		{
			deviceComboBox.Items.Add(deviceInfo);
			if (deviceInfo.DevType == settings.DevType)
				deviceComboBox.SelectedItem = deviceInfo;
		}
		if (deviceComboBox.SelectedItem == null && deviceComboBox.Items.Count > 0)
			deviceComboBox.SelectedIndex = 0;
	}

	/// <summary>
	/// Respond to a change of selected device by resetting the 
	/// fullscreen/windowed radio buttons.  Updating these buttons
	/// will trigger updates of the rest of the dialog.
	/// </summary>
	private void DeviceChanged(object sender, System.EventArgs e)
	{
		GraphicsAdapterInfo adapterInfo = (GraphicsAdapterInfo)adapterComboBox.SelectedItem;
		GraphicsDeviceInfo deviceInfo = (GraphicsDeviceInfo)deviceComboBox.SelectedItem;

		settings.DeviceInfo = deviceInfo;

		// Update fullscreen/windowed radio buttons
		bool HasWindowedDeviceCombo = false;
		bool HasFullscreenDeviceCombo = false;
		foreach (DeviceCombo deviceCombo in deviceInfo.DeviceComboList)
		{
			if (deviceCombo.IsWindowed)
				HasWindowedDeviceCombo = true;
			else
				HasFullscreenDeviceCombo = true;
		}
		windowedRadioButton.Enabled = HasWindowedDeviceCombo;
		fullscreenRadioButton.Enabled = HasFullscreenDeviceCombo;
		if (settings.IsWindowed && HasWindowedDeviceCombo)
		{
			windowedRadioButton.Checked = true;
		}
		else
		{
			fullscreenRadioButton.Checked = true;
		}
		WindowedFullscreenChanged(null, null);
	}

	/// <summary>
	/// Respond to a change of windowed/fullscreen state by rebuilding the
	/// adapter format list, resolution list, and refresh rate list.
	/// Updating the selected adapter format will trigger updates of the 
	/// rest of the dialog.
	/// </summary>
	private void WindowedFullscreenChanged(object sender, System.EventArgs e)
	{
		GraphicsAdapterInfo adapterInfo = (GraphicsAdapterInfo)adapterComboBox.SelectedItem;
		GraphicsDeviceInfo deviceInfo = (GraphicsDeviceInfo)deviceComboBox.SelectedItem;

		if (windowedRadioButton.Checked)
		{
			settings.IsWindowed = true;
			settings.WindowedAdapterInfo = adapterInfo;
			settings.WindowedDeviceInfo = deviceInfo;

			// Update adapter format combo box
			adapterFormatComboBox.Items.Clear();
			adapterFormatComboBox.Items.Add(settings.WindowedDisplayMode.Format);
			adapterFormatComboBox.SelectedIndex = 0;
			adapterFormatComboBox.Enabled = false;

			// Update resolution combo box
			resolutionComboBox.Items.Clear();
			resolutionComboBox.Items.Add(FormatResolution(settings.WindowedDisplayMode.Width, 
				settings.WindowedDisplayMode.Height));

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -