|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DiagramUI;
namespace DataPerformerUI.UserControls
{
/// <summary>
/// User control for regression alias editor
/// </summary>
public partial class RegressionAliasUserControl : UserControl
{
ComboBox cb = new ComboBox();
TextBox dispEdi = new TextBox();
TextBox deltaEdi = new TextBox();
private RegressionAliasUserControl()
{
InitializeComponent();
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="list">List of alias names</param>
public RegressionAliasUserControl(List<string> list)
: this()
{
List<string> lc = new List<string>(list);
lc.Sort();
foreach (string s in lc)
{
cb.Items.Add(s);
}
Label l = new Label();
l.Text = PureDesktop.GetResourceString("Parameter");
l.Left = 10;
l.Top = 10;
Controls.Add(l);
cb.Left = l.Left;
cb.Top = 10 + l.Top + l.Height;
Controls.Add(cb);
l = new Label();
l.Text = PureDesktop.GetResourceString("Dispersion");
l.Left = cb.Left;
l.Top = cb.Top + cb.Height + 10;
Controls.Add(l);
dispEdi.Top = l.Top + l.Height + 10;
dispEdi.Left = l.Left;
dispEdi.Text = "0";
Controls.Add(dispEdi);
l = new Label();
l.Text = PureDesktop.GetResourceString("Delta");
l.Left = cb.Left;
l.Top = dispEdi.Top + dispEdi.Height + 10;
Controls.Add(l);
deltaEdi.Top = l.Top + l.Height + 10;
deltaEdi.Left = l.Left;
deltaEdi.Text = "1e-5";
Controls.Add(deltaEdi);
Height = deltaEdi.Top + deltaEdi.Height + 10;
this.LoadResources();
}
/// <summary>
/// Creares necessary objects
/// </summary>
public object[] Object
{
get
{
object[] o = new object[3];
o[0] = cb.SelectedItem.ToString();
o[1] = Double.Parse(dispEdi.Text);
o[2] = Double.Parse(deltaEdi.Text);
return o;
}
set
{
string n = value[0] as string;
double disp = (double)value[1];
double delta = (double)value[2];
dispEdi.Text = disp + "";
deltaEdi.Text = delta + "";
for (int i = 0; i < cb.Items.Count; i++)
{
if (n.Equals(cb.Items[i].ToString()))
{
cb.SelectedIndex = i;
break;
}
}
}
}
private void RegressionAliasUserControl_Resize(object sender, EventArgs e)
{
cb.Width = Width - 2 * cb.Left;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Ph. D. Petr Ivankov worked as scientific researcher at Russian Mission Control Centre since 1978 up to 2000. Now he is engaged by Aviation training simulators http://dinamika-avia.com/ . His additional interests are:
1) Noncommutative geometry
http://front.math.ucdavis.edu/author/P.Ivankov
2) Literary work (Russian only)
http://zhurnal.lib.ru/editors/3/3d_m/
3) Scientific articles
http://arxiv.org/find/all/1/au:+Ivankov_Petr/0/1/0/all/0/1