public LinearPropertyControl() { // Activates double buffering SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.DoubleBuffer, true); selectedLinearProperty = new LinearProperty(5, "Properties", 0, 10); selectedLinearProperty.Values.Add(new Vector2(0.5f, 8)); selectedLinearProperty.Values.Add(new Vector2(0.7f, 9)); selectedLinearProperty.Values.Add(new Vector2(1f, 0)); this.textBoxMax = new TextBox(); this.textBoxMax.Location = new System.Drawing.Point(4, 23); this.textBoxMax.Name = "textBoxMax"; this.textBoxMax.Size = new System.Drawing.Size(32, 20); this.textBoxMax.TabIndex = 1; this.textBoxMax.Text = selectedLinearProperty.UpperBound.ToString(); this.textBoxMax.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.textBoxMax.Validated += new System.EventHandler(this.textBoxMax_Validated); this.textBoxMax.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBox_KeyDown); this.Controls.Add(textBoxMax); this.textBoxMin = new TextBox(); this.textBoxMin.Location = new System.Drawing.Point(4, 205); this.textBoxMin.Name = "textBoxMin"; this.textBoxMin.Size = new System.Drawing.Size(32, 20); this.textBoxMin.TabIndex = 2; this.textBoxMin.Text = selectedLinearProperty.LowerBound.ToString(); this.textBoxMin.TextAlign = System.Windows.Forms.HorizontalAlignment.Right; this.textBoxMin.Validated += new System.EventHandler(this.textBoxMin_Validated); this.textBoxMin.KeyDown += new System.Windows.Forms.KeyEventHandler(this.textBox_KeyDown); this.Controls.Add(textBoxMin); }
public void CopyValuesTo(LinearProperty linearTarget) { linearTarget.Description = this.Description; linearTarget.LowerBound = this.LowerBound; linearTarget.UpperBound = this.UpperBound; // deep copy the values linearTarget.Values = new List <Vector2>(this.Values.ToArray()); }
private void SelectNewEffect(IceEffect effect) { bool paramtersBoxEnabled = false; comboBoxParameters.Items.Clear(); comboBoxParameters.SelectedItem = null; comboBoxParameters.SelectedText = ""; comboBoxParameters.Text = ""; // if the effect is a new one if (effect != PostProcessAnimation.IceEffect) { PostProcessAnimation.IceEffect = effect; // load the default properties for this effect for (int i = 0; i < 8; i++) { LinearProperty selectedLinearProperty = PostProcessAnimation.LinearProperties[i]; if (effect.ParametersProperties != null && i < effect.ParametersProperties.Length && effect.ParametersProperties[i] != null) { // use the effect's default linear property effect.ParametersProperties[i].CopyValuesTo(selectedLinearProperty); } else { selectedLinearProperty = new LinearProperty(0, String.Empty, 0, 10); } } } if (PostProcessAnimation.IceEffect.ParametersProperties != null) { for (int i = 0; i < PostProcessAnimation.IceEffect.ParametersProperties.Length; i++) { if (PostProcessAnimation.IceEffect.ParametersProperties[i] != null) { comboBoxParameters.Items.Add(PostProcessAnimation.IceEffect.ParametersProperties[i].Description); } } // select the first index if possible if (PostProcessAnimation.IceEffect.ParametersProperties.Length >= 1) { comboBoxParameters.SelectedIndex = 0; paramtersBoxEnabled = true; } } if (paramtersBoxEnabled == false) { comboBoxParameters.Enabled = false; labelParameters.Enabled = false; linearPropertyControl.Visible = false; } else { comboBoxParameters.Enabled = true; labelParameters.Enabled = true; linearPropertyControl.Visible = true; } }
public void CopyValuesTo(LinearProperty linearTarget) { linearTarget.Description = this.Description; linearTarget.LowerBound = this.LowerBound; linearTarget.UpperBound = this.UpperBound; // deep copy the values linearTarget.Values = new List<Vector2>(this.Values.ToArray()); }