/// <summary> /// Windows下获取控件数值 /// </summary> /// <param name="var">变量</param> /// <returns>数值</returns> public double WinGetValue(CVariable var) { double value = 0; INativeBase native = m_chart.Native; WinformControlHostEx host = native.Host as WinformControlHostEx; if (host != null) { String text = host.GetText(); value = CStrA.ConvertStrToDouble(text); } return(value); }
/// <summary> /// 获取参数 /// </summary> private void GetParameters() { if (m_indicator != null) { m_window.Text = "参数设置(" + m_indicator.Name + ")"; IndicatorData indicatorData = m_indicator.Tag as IndicatorData; String[] strs = indicatorData.m_parameters.Split(new String[] { ";" }, StringSplitOptions.RemoveEmptyEntries); int strsSize = strs.Length; //依此创建控件 int addHeight = 0; for (int i = 0; i < strsSize; i++) { String str = strs[i]; String[] strs2 = str.Split(new String[] { "," }, StringSplitOptions.RemoveEmptyEntries); String name = strs2[0]; String value = strs2[3]; //创建标签 LabelA label = new LabelA(); POINT location = new POINT(50, addHeight + 40); label.Location = location; label.Text = name; m_window.AddControl(label); //创建数值控件 SpinA spin = new SpinA(); location.x = 130; location.y = addHeight + 40; spin.Location = location; spin.Maximum = 10000000; spin.Value = CStrA.ConvertStrToDouble(value); m_window.AddControl(spin); addHeight += 30; } m_window.Height += addHeight; //调整按钮的位置 ButtonA cancelButton = GetButton("btnCancel"); ButtonA submitButton = GetButton("btnSubmit"); cancelButton.Top += addHeight; submitButton.Top += addHeight; } }