📄 lightcontrol.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;
namespace EnterDirectX {
/// <summary>
/// Summary description for LC.
/// </summary>
public class LightControl : System.Windows.Forms.Form {
#region class components for Windows Form
internal System.Windows.Forms.TabControl TabControl1;
internal System.Windows.Forms.TabPage Vertex1;
internal System.Windows.Forms.GroupBox GroupBox1;
internal System.Windows.Forms.Label lblBlue1;
internal System.Windows.Forms.NumericUpDown Blue1;
internal System.Windows.Forms.Label lblGreen1;
internal System.Windows.Forms.NumericUpDown Green1;
internal System.Windows.Forms.Label lblRed1;
internal System.Windows.Forms.NumericUpDown Red1;
internal System.Windows.Forms.TabPage Vertex2;
internal System.Windows.Forms.GroupBox GroupBox2;
internal System.Windows.Forms.Label lblBlue2;
internal System.Windows.Forms.NumericUpDown Blue2;
internal System.Windows.Forms.Label lblGreen2;
internal System.Windows.Forms.NumericUpDown Green2;
internal System.Windows.Forms.Label LblRed2;
internal System.Windows.Forms.NumericUpDown Red2;
internal System.Windows.Forms.TabPage Vertex3;
internal System.Windows.Forms.GroupBox GroupBox3;
internal System.Windows.Forms.Label lblBlue3;
internal System.Windows.Forms.NumericUpDown Blue3;
internal System.Windows.Forms.Label lblGreen3;
internal System.Windows.Forms.NumericUpDown Green3;
internal System.Windows.Forms.Label lblRed3;
internal System.Windows.Forms.NumericUpDown Red3;
internal System.Windows.Forms.TabPage Vertex4;
internal System.Windows.Forms.GroupBox GroupBox4;
internal System.Windows.Forms.Label lblBlue4;
internal System.Windows.Forms.NumericUpDown Blue4;
internal System.Windows.Forms.Label lblGreen4;
internal System.Windows.Forms.NumericUpDown Green4;
internal System.Windows.Forms.Label lblRed4;
internal System.Windows.Forms.NumericUpDown Red4;
#endregion
private System.ComponentModel.Container components = null;
private static int x = 0;
private bool endTest = false; public bool EndTest { get { return endTest; } }
private Device device;
private int numVerts = 4;
private VertexBuffer vertBuffer;
private const int numTextures = 10;
private Texture[] textures = new Texture[numTextures];
private const VertexFormats customVertex = VertexFormats.Transformed |
VertexFormats.Diffuse |
VertexFormats.Texture1;
private struct CustomVertex {
public float X;
public float Y;
public float Z;
public float rhw;
public int color;
public float tu;
public float tv;
}
public LightControl() {
InitializeComponent();
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing ) {
if( disposing ) {
if(components != null) {
components.Dispose();
}
}
base.Dispose( disposing );
}
#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.TabControl1 = new System.Windows.Forms.TabControl();
this.Vertex1 = new System.Windows.Forms.TabPage();
this.GroupBox1 = new System.Windows.Forms.GroupBox();
this.lblBlue1 = new System.Windows.Forms.Label();
this.Blue1 = new System.Windows.Forms.NumericUpDown();
this.lblGreen1 = new System.Windows.Forms.Label();
this.Green1 = new System.Windows.Forms.NumericUpDown();
this.lblRed1 = new System.Windows.Forms.Label();
this.Red1 = new System.Windows.Forms.NumericUpDown();
this.Vertex2 = new System.Windows.Forms.TabPage();
this.GroupBox2 = new System.Windows.Forms.GroupBox();
this.lblBlue2 = new System.Windows.Forms.Label();
this.Blue2 = new System.Windows.Forms.NumericUpDown();
this.lblGreen2 = new System.Windows.Forms.Label();
this.Green2 = new System.Windows.Forms.NumericUpDown();
this.LblRed2 = new System.Windows.Forms.Label();
this.Red2 = new System.Windows.Forms.NumericUpDown();
this.Vertex3 = new System.Windows.Forms.TabPage();
this.GroupBox3 = new System.Windows.Forms.GroupBox();
this.lblBlue3 = new System.Windows.Forms.Label();
this.Blue3 = new System.Windows.Forms.NumericUpDown();
this.lblGreen3 = new System.Windows.Forms.Label();
this.Green3 = new System.Windows.Forms.NumericUpDown();
this.lblRed3 = new System.Windows.Forms.Label();
this.Red3 = new System.Windows.Forms.NumericUpDown();
this.Vertex4 = new System.Windows.Forms.TabPage();
this.GroupBox4 = new System.Windows.Forms.GroupBox();
this.lblBlue4 = new System.Windows.Forms.Label();
this.Blue4 = new System.Windows.Forms.NumericUpDown();
this.lblGreen4 = new System.Windows.Forms.Label();
this.Green4 = new System.Windows.Forms.NumericUpDown();
this.lblRed4 = new System.Windows.Forms.Label();
this.Red4 = new System.Windows.Forms.NumericUpDown();
this.TabControl1.SuspendLayout();
this.Vertex1.SuspendLayout();
this.GroupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.Blue1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.Green1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.Red1)).BeginInit();
this.Vertex2.SuspendLayout();
this.GroupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.Blue2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.Green2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.Red2)).BeginInit();
this.Vertex3.SuspendLayout();
this.GroupBox3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.Blue3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.Green3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.Red3)).BeginInit();
this.Vertex4.SuspendLayout();
this.GroupBox4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.Blue4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.Green4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.Red4)).BeginInit();
this.SuspendLayout();
//
// TabControl1
//
this.TabControl1.Controls.Add(this.Vertex1);
this.TabControl1.Controls.Add(this.Vertex2);
this.TabControl1.Controls.Add(this.Vertex3);
this.TabControl1.Controls.Add(this.Vertex4);
this.TabControl1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.TabControl1.Location = new System.Drawing.Point(0, 0);
this.TabControl1.Name = "TabControl1";
this.TabControl1.SelectedIndex = 0;
this.TabControl1.Size = new System.Drawing.Size(256, 184);
this.TabControl1.TabIndex = 9;
//
// Vertex1
//
this.Vertex1.Controls.Add(this.GroupBox1);
this.Vertex1.Location = new System.Drawing.Point(4, 24);
this.Vertex1.Name = "Vertex1";
this.Vertex1.Size = new System.Drawing.Size(248, 156);
this.Vertex1.TabIndex = 0;
this.Vertex1.Text = "Vertex 1";
//
// GroupBox1
//
this.GroupBox1.Controls.Add(this.lblBlue1);
this.GroupBox1.Controls.Add(this.Blue1);
this.GroupBox1.Controls.Add(this.lblGreen1);
this.GroupBox1.Controls.Add(this.Green1);
this.GroupBox1.Controls.Add(this.lblRed1);
this.GroupBox1.Controls.Add(this.Red1);
this.GroupBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.GroupBox1.Location = new System.Drawing.Point(32, 8);
this.GroupBox1.Name = "GroupBox1";
this.GroupBox1.Size = new System.Drawing.Size(184, 144);
this.GroupBox1.TabIndex = 2;
this.GroupBox1.TabStop = false;
this.GroupBox1.Text = "Color";
//
// lblBlue1
//
this.lblBlue1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblBlue1.Location = new System.Drawing.Point(8, 106);
this.lblBlue1.Name = "lblBlue1";
this.lblBlue1.Size = new System.Drawing.Size(80, 24);
this.lblBlue1.TabIndex = 5;
this.lblBlue1.Text = "Blue";
//
// Blue1
//
this.Blue1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Blue1.Increment = new System.Decimal(new int[] {
5,
0,
0,
0});
this.Blue1.Location = new System.Drawing.Point(96, 104);
this.Blue1.Maximum = new System.Decimal(new int[] {
255,
0,
0,
0});
this.Blue1.Name = "Blue1";
this.Blue1.Size = new System.Drawing.Size(56, 29);
this.Blue1.TabIndex = 4;
this.Blue1.ValueChanged += new System.EventHandler(this.Color_TextChanged);
//
// lblGreen1
//
this.lblGreen1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblGreen1.Location = new System.Drawing.Point(8, 66);
this.lblGreen1.Name = "lblGreen1";
this.lblGreen1.Size = new System.Drawing.Size(80, 24);
this.lblGreen1.TabIndex = 3;
this.lblGreen1.Text = "Green";
//
// Green1
//
this.Green1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Green1.Increment = new System.Decimal(new int[] {
5,
0,
0,
0});
this.Green1.Location = new System.Drawing.Point(96, 64);
this.Green1.Maximum = new System.Decimal(new int[] {
255,
0,
0,
0});
this.Green1.Name = "Green1";
this.Green1.Size = new System.Drawing.Size(56, 29);
this.Green1.TabIndex = 2;
this.Green1.ValueChanged += new System.EventHandler(this.Color_TextChanged);
//
// lblRed1
//
this.lblRed1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblRed1.Location = new System.Drawing.Point(8, 26);
this.lblRed1.Name = "lblRed1";
this.lblRed1.Size = new System.Drawing.Size(80, 24);
this.lblRed1.TabIndex = 1;
this.lblRed1.Text = "Red";
//
// Red1
//
this.Red1.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Red1.Increment = new System.Decimal(new int[] {
5,
0,
0,
0});
this.Red1.Location = new System.Drawing.Point(96, 24);
this.Red1.Maximum = new System.Decimal(new int[] {
255,
0,
0,
0});
this.Red1.Name = "Red1";
this.Red1.Size = new System.Drawing.Size(56, 29);
this.Red1.TabIndex = 0;
this.Red1.ValueChanged += new System.EventHandler(this.Color_TextChanged);
//
// Vertex2
//
this.Vertex2.Controls.Add(this.GroupBox2);
this.Vertex2.Location = new System.Drawing.Point(4, 24);
this.Vertex2.Name = "Vertex2";
this.Vertex2.Size = new System.Drawing.Size(248, 156);
this.Vertex2.TabIndex = 1;
this.Vertex2.Text = "Vertex2";
this.Vertex2.Visible = false;
//
// GroupBox2
//
this.GroupBox2.Controls.Add(this.lblBlue2);
this.GroupBox2.Controls.Add(this.Blue2);
this.GroupBox2.Controls.Add(this.lblGreen2);
this.GroupBox2.Controls.Add(this.Green2);
this.GroupBox2.Controls.Add(this.LblRed2);
this.GroupBox2.Controls.Add(this.Red2);
this.GroupBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.GroupBox2.Location = new System.Drawing.Point(32, 8);
this.GroupBox2.Name = "GroupBox2";
this.GroupBox2.Size = new System.Drawing.Size(184, 144);
this.GroupBox2.TabIndex = 3;
this.GroupBox2.TabStop = false;
this.GroupBox2.Text = "Color";
//
// lblBlue2
//
this.lblBlue2.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblBlue2.Location = new System.Drawing.Point(8, 106);
this.lblBlue2.Name = "lblBlue2";
this.lblBlue2.Size = new System.Drawing.Size(80, 24);
this.lblBlue2.TabIndex = 5;
this.lblBlue2.Text = "Blue";
//
// Blue2
//
this.Blue2.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Blue2.Increment = new System.Decimal(new int[] {
5,
0,
0,
0});
this.Blue2.Location = new System.Drawing.Point(96, 104);
this.Blue2.Maximum = new System.Decimal(new int[] {
255,
0,
0,
0});
this.Blue2.Name = "Blue2";
this.Blue2.Size = new System.Drawing.Size(56, 29);
this.Blue2.TabIndex = 4;
this.Blue2.ValueChanged += new System.EventHandler(this.Color_TextChanged);
//
// lblGreen2
//
this.lblGreen2.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblGreen2.Location = new System.Drawing.Point(8, 66);
this.lblGreen2.Name = "lblGreen2";
this.lblGreen2.Size = new System.Drawing.Size(80, 24);
this.lblGreen2.TabIndex = 3;
this.lblGreen2.Text = "Green";
//
// Green2
//
this.Green2.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Green2.Increment = new System.Decimal(new int[] {
5,
0,
0,
0});
this.Green2.Location = new System.Drawing.Point(96, 64);
this.Green2.Maximum = new System.Decimal(new int[] {
255,
0,
0,
0});
this.Green2.Name = "Green2";
this.Green2.Size = new System.Drawing.Size(56, 29);
this.Green2.TabIndex = 2;
this.Green2.ValueChanged += new System.EventHandler(this.Color_TextChanged);
//
// LblRed2
//
this.LblRed2.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.LblRed2.Location = new System.Drawing.Point(8, 26);
this.LblRed2.Name = "LblRed2";
this.LblRed2.Size = new System.Drawing.Size(80, 24);
this.LblRed2.TabIndex = 1;
this.LblRed2.Text = "Red";
//
// Red2
//
this.Red2.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Red2.Increment = new System.Decimal(new int[] {
5,
0,
0,
0});
this.Red2.Location = new System.Drawing.Point(96, 24);
this.Red2.Maximum = new System.Decimal(new int[] {
255,
0,
0,
0});
this.Red2.Name = "Red2";
this.Red2.Size = new System.Drawing.Size(56, 29);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -