Integration of OCCT 6.5.0 from SVN
[occt.git] / samples / CSharp / IE / MaterialDialog.cs
CommitLineData
7fd59977 1using System;
2using System.Drawing;
3using System.Collections;
4using System.ComponentModel;
5using System.Windows.Forms;
6
7namespace IE
8{
9 /// <summary>
10 /// Summary description for MaterialDialog.
11 /// </summary>
12 public class MaterialDialog : System.Windows.Forms.Form
13 {
14 /// <summary>
15 /// Required designer variable.
16 /// </summary>
17 private System.ComponentModel.Container components = null;
18
19 public MaterialDialog()
20 {
21 //
22 // Required for Windows Form Designer support
23 //
24 InitializeComponent();
25
26 //
27 // TODO: Add any constructor code after InitializeComponent call
28 //
29 this.myView=null;
30 }
31
32 /// <summary>
33 /// Clean up any resources being used.
34 /// </summary>
35 protected override void Dispose( bool disposing )
36 {
37 if( disposing )
38 {
39 if(components != null)
40 {
41 components.Dispose();
42 }
43 }
44 base.Dispose( disposing );
45 }
46
47 #region Windows Form Designer generated code
48 /// <summary>
49 /// Required method for Designer support - do not modify
50 /// the contents of this method with the code editor.
51 /// </summary>
52 private void InitializeComponent()
53 {
54 System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MaterialDialog));
55 this.BTN_PLASTER = new System.Windows.Forms.Button();
56 this.BTN_BRASS = new System.Windows.Forms.Button();
57 this.BTN_BRONZE = new System.Windows.Forms.Button();
58 this.BTN_COPPER = new System.Windows.Forms.Button();
59 this.BTN_GOLD = new System.Windows.Forms.Button();
60 this.BTN_PEWTER = new System.Windows.Forms.Button();
61 this.BTN_PLASTIC = new System.Windows.Forms.Button();
62 this.BTN_SILVER = new System.Windows.Forms.Button();
63 this.SuspendLayout();
64 //
65 // BTN_PLASTER
66 //
67 this.BTN_PLASTER.Location = new System.Drawing.Point(16, 8);
68 this.BTN_PLASTER.Name = "BTN_PLASTER";
69 this.BTN_PLASTER.Size = new System.Drawing.Size(80, 24);
70 this.BTN_PLASTER.TabIndex = 0;
71 this.BTN_PLASTER.Text = "Plaster";
72 this.BTN_PLASTER.Click += new System.EventHandler(this.button1_Click);
73 //
74 // BTN_BRASS
75 //
76 this.BTN_BRASS.Location = new System.Drawing.Point(16, 40);
77 this.BTN_BRASS.Name = "BTN_BRASS";
78 this.BTN_BRASS.Size = new System.Drawing.Size(80, 24);
79 this.BTN_BRASS.TabIndex = 1;
80 this.BTN_BRASS.Text = "Brass";
81 this.BTN_BRASS.Click += new System.EventHandler(this.BTN_BRASS_Click);
82 //
83 // BTN_BRONZE
84 //
85 this.BTN_BRONZE.Location = new System.Drawing.Point(16, 72);
86 this.BTN_BRONZE.Name = "BTN_BRONZE";
87 this.BTN_BRONZE.Size = new System.Drawing.Size(80, 24);
88 this.BTN_BRONZE.TabIndex = 2;
89 this.BTN_BRONZE.Text = "Bronze";
90 this.BTN_BRONZE.Click += new System.EventHandler(this.BTN_BRONZE_Click);
91 //
92 // BTN_COPPER
93 //
94 this.BTN_COPPER.Location = new System.Drawing.Point(16, 104);
95 this.BTN_COPPER.Name = "BTN_COPPER";
96 this.BTN_COPPER.Size = new System.Drawing.Size(80, 24);
97 this.BTN_COPPER.TabIndex = 3;
98 this.BTN_COPPER.Text = "Copper";
99 this.BTN_COPPER.Click += new System.EventHandler(this.BTN_COPPER_Click);
100 //
101 // BTN_GOLD
102 //
103 this.BTN_GOLD.Location = new System.Drawing.Point(16, 136);
104 this.BTN_GOLD.Name = "BTN_GOLD";
105 this.BTN_GOLD.Size = new System.Drawing.Size(80, 24);
106 this.BTN_GOLD.TabIndex = 4;
107 this.BTN_GOLD.Text = "Gold";
108 this.BTN_GOLD.Click += new System.EventHandler(this.BTN_GOLD_Click);
109 //
110 // BTN_PEWTER
111 //
112 this.BTN_PEWTER.Location = new System.Drawing.Point(16, 168);
113 this.BTN_PEWTER.Name = "BTN_PEWTER";
114 this.BTN_PEWTER.Size = new System.Drawing.Size(80, 24);
115 this.BTN_PEWTER.TabIndex = 5;
116 this.BTN_PEWTER.Text = "Pewter";
117 this.BTN_PEWTER.Click += new System.EventHandler(this.BTN_PEWTER_Click);
118 //
119 // BTN_PLASTIC
120 //
121 this.BTN_PLASTIC.Location = new System.Drawing.Point(16, 200);
122 this.BTN_PLASTIC.Name = "BTN_PLASTIC";
123 this.BTN_PLASTIC.Size = new System.Drawing.Size(80, 24);
124 this.BTN_PLASTIC.TabIndex = 6;
125 this.BTN_PLASTIC.Text = "Plastic";
126 this.BTN_PLASTIC.Click += new System.EventHandler(this.BTN_PLASTIC_Click);
127 //
128 // BTN_SILVER
129 //
130 this.BTN_SILVER.Location = new System.Drawing.Point(16, 232);
131 this.BTN_SILVER.Name = "BTN_SILVER";
132 this.BTN_SILVER.Size = new System.Drawing.Size(80, 24);
133 this.BTN_SILVER.TabIndex = 7;
134 this.BTN_SILVER.Text = "Silver";
135 this.BTN_SILVER.Click += new System.EventHandler(this.BTN_SILVER_Click);
136 //
137 // MaterialDialog
138 //
139 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
140 this.ClientSize = new System.Drawing.Size(112, 273);
141 this.Controls.Add(this.BTN_SILVER);
142 this.Controls.Add(this.BTN_PLASTIC);
143 this.Controls.Add(this.BTN_PEWTER);
144 this.Controls.Add(this.BTN_GOLD);
145 this.Controls.Add(this.BTN_COPPER);
146 this.Controls.Add(this.BTN_BRONZE);
147 this.Controls.Add(this.BTN_BRASS);
148 this.Controls.Add(this.BTN_PLASTER);
149 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
150 this.MaximizeBox = false;
151 this.MinimizeBox = false;
152 this.Name = "MaterialDialog";
153 this.Text = "MaterialDialog";
154 this.ResumeLayout(false);
155
156 }
157 #endregion
158
159 private System.Windows.Forms.Button BTN_PLASTER;
160 private System.Windows.Forms.Button BTN_BRASS;
161 private System.Windows.Forms.Button BTN_BRONZE;
162 private System.Windows.Forms.Button BTN_COPPER;
163 private System.Windows.Forms.Button BTN_GOLD;
164 private System.Windows.Forms.Button BTN_PEWTER;
165 private System.Windows.Forms.Button BTN_PLASTIC;
166 private System.Windows.Forms.Button BTN_SILVER;
167
168 private int myMaterial;
169 private shell myView;
170
171 private void button1_Click(object sender, System.EventArgs e)
172 {
173 this.myMaterial=5;
174 ChangeMaterial();
175 }
176
177 private void BTN_BRASS_Click(object sender, System.EventArgs e)
178 {
179 this.myMaterial=0;
180 ChangeMaterial();
181 }
182
183 private void BTN_BRONZE_Click(object sender, System.EventArgs e)
184 {
185 this.myMaterial=1;
186 ChangeMaterial();
187 }
188
189 private void BTN_COPPER_Click(object sender, System.EventArgs e)
190 {
191 this.myMaterial=2;
192 ChangeMaterial();
193 }
194
195 private void BTN_GOLD_Click(object sender, System.EventArgs e)
196 {
197 this.myMaterial=3;
198 ChangeMaterial();
199 }
200
201 private void BTN_PEWTER_Click(object sender, System.EventArgs e)
202 {
203 this.myMaterial=4;
204 ChangeMaterial();
205 }
206
207 private void BTN_PLASTIC_Click(object sender, System.EventArgs e)
208 {
209 this.myMaterial=6;
210 ChangeMaterial();
211 }
212
213 private void BTN_SILVER_Click(object sender, System.EventArgs e)
214 {
215 this.myMaterial=7;
216 ChangeMaterial();
217 }
218
219 public int Material
220 {
221 get
222 {
223 return this.myMaterial;
224 }
225 set
226 {
227 this.myMaterial=value;
228 }
229 }
230
231 public void ChangeMaterial()
232 {
233 if (myView==null)
234 return;
235 myView.SetMaterial(this.myMaterial);
236
237 }
238
239 public shell View
240 {
241 set
242 {
243 this.myView=value;
244 }
245 }
246
247 }
248}