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

📄 d3dsettingsform.cs

📁 Particle System Test Application on C#
💻 CS
📖 第 1 页 / 共 3 页
字号:
//-----------------------------------------------------------------------------
// File: D3DSettingsForm.cs
//
// Desc: Application form for setting up user defined display settings
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
using System;
using System.Collections;
using System.Windows.Forms;
using Microsoft.DirectX.Direct3D;





/// <summary>
/// A form to allow the user to change the current D3D settings.
/// </summary>
public class D3DSettingsForm : System.Windows.Forms.Form
{
	private D3DEnumeration enumeration;
	public D3DSettings settings; // Potential new D3D settings

	private System.Windows.Forms.GroupBox adapterDeviceGroupBox;
	private System.Windows.Forms.Label displayAdapterLabel;
	private System.Windows.Forms.ComboBox adapterComboBox;
	private System.Windows.Forms.Label deviceLabel;
	private System.Windows.Forms.ComboBox deviceComboBox;
	private System.Windows.Forms.GroupBox modeSettingsGroupBox;
	private System.Windows.Forms.RadioButton windowedRadioButton;
	private System.Windows.Forms.RadioButton fullscreenRadioButton;
	private System.Windows.Forms.Label adapterFormatLabel;
	private System.Windows.Forms.ComboBox adapterFormatComboBox;
	private System.Windows.Forms.Label resolutionLabel;
	private System.Windows.Forms.ComboBox resolutionComboBox;
	private System.Windows.Forms.Label refreshRateLabel;
	private System.Windows.Forms.ComboBox refreshRateComboBox;
	private System.Windows.Forms.GroupBox otherSettingsGroupBox;
	private System.Windows.Forms.Label backBufferFormatLabel;
	private System.Windows.Forms.ComboBox backBufferFormatComboBox;
	private System.Windows.Forms.Label depthStencilBufferLabel;
	private System.Windows.Forms.ComboBox depthStencilBufferComboBox;
	private System.Windows.Forms.Label multisampleLabel;
	private System.Windows.Forms.ComboBox multisampleComboBox;
	private System.Windows.Forms.Label vertexProcLabel;
	private System.Windows.Forms.ComboBox vertexProcComboBox;
	private System.Windows.Forms.Label presentIntervalLabel;
	private System.Windows.Forms.ComboBox presentIntervalComboBox;
	private System.Windows.Forms.Button okButton;
	private System.Windows.Forms.Button cancelButton;
	private System.Windows.Forms.ComboBox multisampleQualityComboBox;
	private System.Windows.Forms.Label multisampleQualityLabel;




	/// <summary>
	/// Required designer variable.
	/// </summary>
	private System.ComponentModel.Container components = null;


    
    
    /// <summary>
	/// Constructor.  Pass in an enumeration and the current D3D settings.
	/// </summary>
	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>
	/// Clean up any resources being used.
	/// </summary>
	protected override void Dispose(bool Disposing)
	{
		base.Dispose(Disposing);
		if (components != null)	
			components.Dispose();
	}


    
    
    #region Windows Form Designer generated code
	/// <summary>
	/// Required method for Designer support - do not modify
	/// the contents of this method with the code editor.
	/// </summary>
	private void InitializeComponent()
	{
		this.adapterDeviceGroupBox = new System.Windows.Forms.GroupBox();
		this.deviceComboBox = new System.Windows.Forms.ComboBox();
		this.deviceLabel = new System.Windows.Forms.Label();
		this.adapterComboBox = new System.Windows.Forms.ComboBox();
		this.displayAdapterLabel = new System.Windows.Forms.Label();
		this.fullscreenRadioButton = new System.Windows.Forms.RadioButton();
		this.cancelButton = new System.Windows.Forms.Button();
		this.otherSettingsGroupBox = new System.Windows.Forms.GroupBox();
		this.multisampleQualityComboBox = new System.Windows.Forms.ComboBox();
		this.multisampleQualityLabel = new System.Windows.Forms.Label();
		this.multisampleComboBox = new System.Windows.Forms.ComboBox();
		this.backBufferFormatComboBox = new System.Windows.Forms.ComboBox();
		this.multisampleLabel = new System.Windows.Forms.Label();
		this.depthStencilBufferLabel = new System.Windows.Forms.Label();
		this.backBufferFormatLabel = new System.Windows.Forms.Label();
		this.depthStencilBufferComboBox = new System.Windows.Forms.ComboBox();
		this.vertexProcComboBox = new System.Windows.Forms.ComboBox();
		this.vertexProcLabel = new System.Windows.Forms.Label();
		this.presentIntervalComboBox = new System.Windows.Forms.ComboBox();
		this.presentIntervalLabel = new System.Windows.Forms.Label();
		this.resolutionComboBox = new System.Windows.Forms.ComboBox();
		this.windowedRadioButton = new System.Windows.Forms.RadioButton();
		this.resolutionLabel = new System.Windows.Forms.Label();
		this.refreshRateComboBox = new System.Windows.Forms.ComboBox();
		this.adapterFormatLabel = new System.Windows.Forms.Label();
		this.refreshRateLabel = new System.Windows.Forms.Label();
		this.okButton = new System.Windows.Forms.Button();
		this.modeSettingsGroupBox = new System.Windows.Forms.GroupBox();
		this.adapterFormatComboBox = new System.Windows.Forms.ComboBox();
		this.adapterDeviceGroupBox.SuspendLayout();
		this.otherSettingsGroupBox.SuspendLayout();
		this.modeSettingsGroupBox.SuspendLayout();
		this.SuspendLayout();
		// 
		// adapterDeviceGroupBox
		// 
		this.adapterDeviceGroupBox.Controls.AddRange(new System.Windows.Forms.Control[] {
																							this.deviceComboBox,
																							this.deviceLabel,
																							this.adapterComboBox,
																							this.displayAdapterLabel});
		this.adapterDeviceGroupBox.Location = new System.Drawing.Point(16, 8);
		this.adapterDeviceGroupBox.Name = "adapterDeviceGroupBox";
		this.adapterDeviceGroupBox.Size = new System.Drawing.Size(400, 80);
		this.adapterDeviceGroupBox.TabIndex = 0;
		this.adapterDeviceGroupBox.TabStop = false;
		this.adapterDeviceGroupBox.Text = "Adapter and device";
		// 
		// deviceComboBox
		// 
		this.deviceComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.deviceComboBox.DropDownWidth = 121;
		this.deviceComboBox.Location = new System.Drawing.Point(160, 48);
		this.deviceComboBox.Name = "deviceComboBox";
		this.deviceComboBox.Size = new System.Drawing.Size(232, 21);
		this.deviceComboBox.TabIndex = 3;
		this.deviceComboBox.SelectedIndexChanged += new System.EventHandler(this.DeviceChanged);
		// 
		// deviceLabel
		// 
		this.deviceLabel.Location = new System.Drawing.Point(8, 48);
		this.deviceLabel.Name = "deviceLabel";
		this.deviceLabel.Size = new System.Drawing.Size(152, 23);
		this.deviceLabel.TabIndex = 2;
		this.deviceLabel.Text = "Render &Device:";
		// 
		// adapterComboBox
		// 
		this.adapterComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
		this.adapterComboBox.DropDownWidth = 121;
		this.adapterComboBox.Location = new System.Drawing.Point(160, 24);
		this.adapterComboBox.Name = "adapterComboBox";
		this.adapterComboBox.Size = new System.Drawing.Size(232, 21);
		this.adapterComboBox.TabIndex = 1;
		this.adapterComboBox.SelectedIndexChanged += new System.EventHandler(this.AdapterChanged);
		// 
		// displayAdapterLabel
		// 
		this.displayAdapterLabel.Location = new System.Drawing.Point(8, 24);
		this.displayAdapterLabel.Name = "displayAdapterLabel";
		this.displayAdapterLabel.Size = new System.Drawing.Size(152, 23);
		this.displayAdapterLabel.TabIndex = 0;
		this.displayAdapterLabel.Text = "Display &Adapter:";
		// 
		// fullscreenRadioButton
		// 
		this.fullscreenRadioButton.Location = new System.Drawing.Point(9, 38);
		this.fullscreenRadioButton.Name = "fullscreenRadioButton";
		this.fullscreenRadioButton.Size = new System.Drawing.Size(152, 24);
		this.fullscreenRadioButton.TabIndex = 1;
		this.fullscreenRadioButton.Text = "&Fullscreen";
		// 
		// 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

⌨️ 快捷键说明

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