// Generate deep copies public NewTextBox Clone() { NewTextBox temp = new NewTextBox(); // Clone properties temp.Text = this.Text; temp.FontSize = this.FontSize; temp.SetValue(Canvas.TopProperty, this.GetValue(Canvas.TopProperty)); temp.SetValue(Canvas.LeftProperty, this.GetValue(Canvas.LeftProperty)); temp.TextWrapping = this.TextWrapping; temp.MinWidth = this.MinWidth; temp.MaxWidth = this.MaxWidth; temp.Height = this.Height; temp.MaxHeight = this.MaxHeight; temp.RegexString = this.RegexString; temp.DefaultText = this.DefaultText; temp.BorderBrush = this.BorderBrush; //temp.Width = this.Width; // =========================================== // Add new elements here // =========================================== // Write log to console Console.WriteLine(DateTime.Now.ToString() + @" : Clone TextBox '" + this.Text + @"' for rectangle"); return(temp); }
public string GetCode() { NewTextBox newTextBox = new NewTextBox(); string Code = ""; //newTextBox.Text = ""; for (int i = 0; i < this.Children.Count; i++) { if (this.Children[i] is NewTextBox) { newTextBox = (NewTextBox)this.Children[i]; break; } } if (Device_Addr > 0) { if (newTextBox.TextAvailable()) { Code = Code_Prefix + " " + Device_Addr.ToString() + "," + newTextBox.Text + " " + Code_Suffix + "\r\n"; } else { Code = Code_Prefix + " " + Device_Addr.ToString() + " " + Code_Suffix + "\r\n"; } } else { if (newTextBox.TextAvailable()) { Code = Code_Prefix + " " + newTextBox.Text + " " + Code_Suffix + "\r\n"; } else { Code = Code_Prefix + " " + Code_Suffix + "\r\n"; } } if (AnchorPointType == Anchors.AnchorType_IndentRight) { Code = "{\r\n" + Code; } else if (AnchorPointType == Anchors.AnchorType_IndentLeft) { Code = "\r\n}" + Code; } return(Code); }