0024147: Update of CSharp sample
[occt.git] / samples / CSharp / WinForms / TransparencyDialog.cs
1 using System;
2 using System.Drawing;
3 using System.Collections;
4 using System.ComponentModel;
5 using System.Windows.Forms;
6
7 namespace IE_WinForms
8 {
9   /// <summary>
10   /// Summary description for TransparencyDialog.
11   /// </summary>
12   public class TransparencyDialog : System.Windows.Forms.Form
13   {
14     private System.Windows.Forms.NumericUpDown MyTransparency;
15     /// <summary>
16     /// Required designer variable.
17     /// </summary>
18     private System.ComponentModel.Container components = null;
19     private OCCTProxy myView;
20
21     public TransparencyDialog()
22     {
23       //
24       // Required for Windows Form Designer support
25       //
26       InitializeComponent();
27
28       //
29       // TODO: Add any constructor code after InitializeComponent call
30       //
31       myView = null;
32     }
33
34     /// <summary>
35     /// Clean up any resources being used.
36     /// </summary>
37     protected override void Dispose(bool disposing)
38     {
39       if (disposing)
40       {
41         if (components != null)
42         {
43           components.Dispose();
44         }
45       }
46       base.Dispose(disposing);
47     }
48
49     #region Windows Form Designer generated code
50     /// <summary>
51     /// Required method for Designer support - do not modify
52     /// the contents of this method with the code editor.
53     /// </summary>
54     private void InitializeComponent()
55     {
56       System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(TransparencyDialog));
57       this.MyTransparency = new System.Windows.Forms.NumericUpDown();
58       ((System.ComponentModel.ISupportInitialize)(this.MyTransparency)).BeginInit();
59       this.SuspendLayout();
60       // 
61       // MyTransparency
62       // 
63       this.MyTransparency.Location = new System.Drawing.Point(16, 16);
64       this.MyTransparency.Maximum = new System.Decimal(new int[] {
65                                                                                                                                                    10,
66                                                                                                                                                    0,
67                                                                                                                                                    0,
68                                                                                                                                                    0});
69       this.MyTransparency.Name = "MyTransparency";
70       this.MyTransparency.Size = new System.Drawing.Size(96, 20);
71       this.MyTransparency.TabIndex = 0;
72       this.MyTransparency.ValueChanged += new System.EventHandler(this.MyTransparency_ValueChanged);
73       // 
74       // TransparencyDialog
75       // 
76       this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
77       this.ClientSize = new System.Drawing.Size(128, 53);
78       this.Controls.Add(this.MyTransparency);
79       this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
80       this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
81       this.MaximizeBox = false;
82       this.MinimizeBox = false;
83       this.Name = "TransparencyDialog";
84       this.Text = "TransparencyDialog";
85       ((System.ComponentModel.ISupportInitialize)(this.MyTransparency)).EndInit();
86       this.ResumeLayout(false);
87
88     }
89     #endregion
90
91     private void MyTransparency_ValueChanged(object sender, System.EventArgs e)
92     {
93       if (this.myView == null)
94         return;
95       int transp = (int)this.MyTransparency.Value;
96       this.myView.SetTransparency(transp);
97     }
98
99     public OCCTProxy View
100     {
101       set
102       {
103         this.myView = value;
104       }
105     }
106
107   }
108 }