public MslText(MslDialog dialog, int x, int y, int width, int height, string text, string style = null) : base(ControlType.Text, dialog, x, y, width, height, style) { this.Control = new Label() { AutoSize = false, Left = x, Top = y, Width = width, Height = height, Text = text }; }
public MslEdit(MslDialog dialog, int x, int y, int width, int height, string text, string style = null) : base(ControlType.Edit, dialog, x, y, width, height, style) { this.Control = new TextBox() { Multiline = true, Left = x, Top = y, Width = width, Height = height, Text = text }; }
public MslBox(MslDialog dialog, int x, int y, int width, int height, string text, string style = null) : base(ControlType.Box, dialog, x, y, width, height, style) { this.Control = new GroupBox() { Left = x, Top = y, Width = width, Height = height, Text = text }; }
public MslRadio(MslDialog dialog, int x, int y, int width, int height, string text, string style = null) : base(ControlType.Radio, dialog, x, y, width, height, style) { this.Control = new RadioButton() { Left = x, Top = y, Width = width, Height = height, Text = text, UseVisualStyleBackColor = true }; }
public MslCombo(MslDialog dialog, int x, int y, int width, int height, string style = null) : base(ControlType.Combo, dialog, x, y, width, height, style) { this.Control = new ComboBox() { IntegralHeight = false, DropDownStyle = ComboBoxStyle.Simple, Left = x, Top = y, Width = width, Height = height }; }
public MslButton(MslDialog dialog, int x, int y, int width, int height, string text, string style = null) : base(ControlType.Button, dialog, x, y, width, height, style) { this.Control = new Button() { Left = x, Top = y, Width = width, Height = height, Text = text, UseVisualStyleBackColor = true, ForeColor = SystemColors.ControlText }; }
public MslIcon(MslDialog dialog, int x, int y, int width, int height, string style = null) : base(ControlType.Icon, dialog, x, y, width, height, style) { this.Control = new PictureBox() { Left = x, Top = y, Width = width, Height = height, BorderStyle = BorderStyle.Fixed3D }; }
public MslList(MslDialog dialog, int x, int y, int width, int height, string style = null) : base(ControlType.List, dialog, x, y, width, height, style) { this.Control = new ListBox() { IntegralHeight = false, Left = x, Top = y, Width = width, Height = height }; }
public MslScroll(MslDialog dialog, int x, int y, int width, int height, string text, string style = null) : base(ControlType.Scroll, dialog, x, y, width, height, style) { this.Control = new VScrollBar() { Text = text }; this.UpdateRectangle(); }
public static bool TryParse(MslDialog dialog, string s, out MslText control) { var match = MslControl.ParseRegex.Match(s); if (!match.Success) { control = null; return(false); } control = new MslText(dialog, int.Parse(match.Groups[4].Value), int.Parse(match.Groups[5].Value), int.Parse(match.Groups[6].Value), int.Parse(match.Groups[7].Value), match.Groups[2].Value, match.Groups[8].Value) { ID = int.Parse(match.Groups[3].Value) }; return(true); }
public static new MslText Parse(MslDialog dialog, string s) { var match = MslControl.ParseRegex.Match(s); // TODO: More descriptive exception message. if (!match.Success) { throw new FormatException(); } return(new MslText(dialog, int.Parse(match.Groups[4].Value), int.Parse(match.Groups[5].Value), int.Parse(match.Groups[6].Value), int.Parse(match.Groups[7].Value), match.Groups[2].Value, match.Groups[8].Value) { ID = int.Parse(match.Groups[3].Value) }); }
protected MslMovableControl(ControlType type, MslDialog dialog, int x, int y, int width, int height, string style) : base(type, style) { if (dialog == null) { throw new ArgumentNullException("dialog"); } this.Dialog = dialog; this.x = x; this.y = y; this.width = width; this.height = height; this.UpdateRectangle(); }
public MslTab(MslDialog dialog, int x, int y, int width, int height, string text, string style = null) : base(ControlType.Tab, dialog, x, y, width, height, style) { var control = new TabControl() { Left = x, Top = y, Width = width, Height = height, Text = text, ImageList = new ImageList() }; control.ImageList.Images.Add(MScripter.Properties.Resources.newTab); control.TabPages.Add(new TabPage(text)); control.TabPages.Add(new TabPage("New") { ImageIndex = 0 }); this.tabRectangles.Add(control.GetTabRect(0)); this.tabRectangles.Add(control.GetTabRect(1)); this.tabID.Add(-1); this.Control = control; }
protected MslMovableControl(ControlType type, MslDialog dialog, int x, int y, int width, int height) : this(type, dialog, x, y, width, height, null) { }
public static bool TryParse(MslDialog dialog, string s, out MslControl control) { bool result; s = s.Trim(); int space = s.IndexOf(' '); if (space == -1) { control = null; return(false); } string type = s.Substring(0, space); if (type.Equals("text", StringComparison.OrdinalIgnoreCase)) { MslText control2; result = MslText.TryParse(dialog, s, out control2); control = control2; } else if (type.Equals("edit", StringComparison.OrdinalIgnoreCase)) { MslEdit control2; result = MslEdit.TryParse(dialog, s, out control2); control = control2; } else if (type.Equals("button", StringComparison.OrdinalIgnoreCase)) { MslButton control2; result = MslButton.TryParse(dialog, s, out control2); control = control2; } else if (type.Equals("check", StringComparison.OrdinalIgnoreCase)) { MslCheck control2; result = MslCheck.TryParse(dialog, s, out control2); control = control2; } else if (type.Equals("radio", StringComparison.OrdinalIgnoreCase)) { MslRadio control2; result = MslRadio.TryParse(dialog, s, out control2); control = control2; } else if (type.Equals("box", StringComparison.OrdinalIgnoreCase)) { MslBox control2; result = MslBox.TryParse(dialog, s, out control2); control = control2; } else if (type.Equals("scroll", StringComparison.OrdinalIgnoreCase)) { MslScroll control2; result = MslScroll.TryParse(dialog, s, out control2); control = control2; } else if (type.Equals("list", StringComparison.OrdinalIgnoreCase)) { MslList control2; result = MslList.TryParse(dialog, s, out control2); control = control2; } else if (type.Equals("combo", StringComparison.OrdinalIgnoreCase)) { MslCombo control2; result = MslCombo.TryParse(dialog, s, out control2); control = control2; } else if (type.Equals("icon", StringComparison.OrdinalIgnoreCase)) { MslIcon control2; result = MslIcon.TryParse(dialog, s, out control2); control = control2; } else if (type.Equals("link", StringComparison.OrdinalIgnoreCase)) { MslLink control2; result = MslLink.TryParse(dialog, s, out control2); control = control2; } else if (type.Equals("tab", StringComparison.OrdinalIgnoreCase)) { MslTab control2; result = MslTab.TryParse(dialog, s, out control2); control = control2; } else if (type.Equals("menu", StringComparison.OrdinalIgnoreCase)) { MslMenu control2; result = MslMenu.TryParse(s, out control2); control = control2; } else if (type.Equals("item", StringComparison.OrdinalIgnoreCase)) { MslMenu.MslItem control2; result = MslMenu.MslItem.TryParse(s, out control2); control = control2; } else { control = null; return(false); } return(result); }
public static MslControl Parse(MslDialog dialog, string s) { s = s.Trim(); int space = s.IndexOf(' '); if (space == -1) { throw new FormatException("Invalid code: missing ID."); } string type = s.Substring(0, space); if (type.Equals("text", StringComparison.OrdinalIgnoreCase)) { return(MslText.Parse(dialog, s)); } if (type.Equals("edit", StringComparison.OrdinalIgnoreCase)) { return(MslEdit.Parse(dialog, s)); } if (type.Equals("button", StringComparison.OrdinalIgnoreCase)) { return(MslButton.Parse(dialog, s)); } if (type.Equals("check", StringComparison.OrdinalIgnoreCase)) { return(MslCheck.Parse(dialog, s)); } if (type.Equals("radio", StringComparison.OrdinalIgnoreCase)) { return(MslRadio.Parse(dialog, s)); } if (type.Equals("box", StringComparison.OrdinalIgnoreCase)) { return(MslBox.Parse(dialog, s)); } if (type.Equals("scroll", StringComparison.OrdinalIgnoreCase)) { return(MslScroll.Parse(dialog, s)); } if (type.Equals("list", StringComparison.OrdinalIgnoreCase)) { return(MslList.Parse(dialog, s)); } if (type.Equals("combo", StringComparison.OrdinalIgnoreCase)) { return(MslCombo.Parse(dialog, s)); } if (type.Equals("icon", StringComparison.OrdinalIgnoreCase)) { return(MslIcon.Parse(dialog, s)); } if (type.Equals("link", StringComparison.OrdinalIgnoreCase)) { return(MslLink.Parse(dialog, s)); } if (type.Equals("tab", StringComparison.OrdinalIgnoreCase)) { return(MslTab.Parse(dialog, s)); } if (type.Equals("menu", StringComparison.OrdinalIgnoreCase)) { return(MslMenu.Parse(s)); } if (type.Equals("item", StringComparison.OrdinalIgnoreCase)) { return(MslMenu.MslItem.Parse(s)); } throw new FormatException("Invalid code: no such control type as '" + type + "."); }