private void ProcessText(XmlElement xElementControl, RLabel control) { control.Text = this.GetString(xElementControl.Attributes, "Text"); control.对齐方式 = (TextAlignment)this.GetInteger(xElementControl.Attributes, "Alignment"); if (xElementControl["Font"] != null) { string familyName = xElementControl["Font"].Attributes["Name"].Value; int num = Convert.ToInt16(Math.Round(Convert.ToDouble(xElementControl["Font"].Attributes["Size"].Value))); FontStyle regular = FontStyle.Regular; if (xElementControl["Font"].Attributes["FontStyle"] != null) { string str2 = xElementControl["Font"].Attributes["FontStyle"].Value; if (str2.Equals(FontStyle.Bold.ToString())) { regular = FontStyle.Bold; } if (str2.Equals(FontStyle.Italic.ToString())) { regular = FontStyle.Italic; } if (str2.Equals(FontStyle.Strikeout.ToString())) { regular = FontStyle.Strikeout; } if (str2.Equals(FontStyle.Underline.ToString())) { regular = FontStyle.Underline; } } control.Font = new Font(familyName, (float)num, regular); } }
private void RunR() { var path = System.IO.Path.GetDirectoryName(Application.ExecutablePath); var cmd = ClassificationRadioButton.Checked ? "class.R" : "function.R"; var args = path.Replace("\\", "/") + "/"; var process = new Process { StartInfo = new ProcessStartInfo { FileName = "Rscript.exe", Arguments = cmd + " " + args, UseShellExecute = false, RedirectStandardOutput = true, RedirectStandardError = true, CreateNoWindow = true }, EnableRaisingEvents = true }; process.ErrorDataReceived += ProcessR_OutputDataReceived; process.OutputDataReceived += ProcessR_OutputDataReceived; Debug.WriteLine(cmd + " " + args); process.Start(); process.BeginOutputReadLine(); RLabel.Invoke((MethodInvoker)(() => { RLabel.Visible = true; } )); }
private void AddControlText(XmlElement xElementRoot, RLabel control) { this.AddAtributo(xElementRoot, "Text", control.Text); this.AddAtributo(xElementRoot, "Alignment", ((short)control.对齐方式).ToString()); XmlElement element = this.AddElement(xElementRoot, "Font"); this.AddAtributo(element, "Name", control.Font.Name.ToString()); this.AddAtributo(element, "Size", control.Font.Size.ToString()); this.AddAtributo(element, "Height", control.Font.Height.ToString()); this.AddAtributo(element, "FontStyle", control.Font.Style.ToString()); }
private void ProcessR_OutputDataReceived(object sender, DataReceivedEventArgs e) { Debug.WriteLine(e.Data); if (e.Data == null) { return; } string data = e.Data.ToString().Replace("\"", ""); if (data.Contains("[1] ")) { ChartBox.Invoke((MethodInvoker)(() => { ChartBox.Image = Image.FromFile(data.Substring(4, data.Length - 4) + ".png"); } )); RLabel.Invoke((MethodInvoker)(() => { RLabel.Visible = false; } )); } }
public static DialogResult ShowDialog(RLabel label) { form = new FormEditMemo(); form.rlabel = label; return(form.ShowDialog()); }