public virtual object Clone() { FieldLabel pcc = new FieldLabel(); if (this.CurrentField != null) { pcc.CurrentField = this.CurrentField.Clone(); } pcc.IsFlag = this.IsFlag; pcc.IsMainField = this.IsMainField; pcc.Format = this.Format; return(pcc); }
public virtual object Clone() { TrendLabel pcc = new TrendLabel(); if (this.TrendLabelSource != null) { pcc.TrendLabelSource = this.TrendLabelSource.Clone(); } pcc.Source = this.Source; pcc.TextAlignment = this.TextAlignment; pcc.LineColor = this.LineColor; pcc.LineWidth = this.LineWidth; pcc._TextLineAlignment = this._TextLineAlignment; pcc._TextOrientation = this._TextOrientation; if (this.FieldFlag != null) { FieldLabel[] bb = new FieldLabel[this.FieldFlag.Count]; this.FieldFlag.CopyTo(bb); pcc.FieldFlag = new List <FieldLabel>(bb); } return(pcc); }
private int SaveLabelInfo() { int result = 0; try { TreeNode node = DataSource.SelectedNode; _LabelSource = new TrendLabel(); if (node.Tag != null && node.Tag is PMS.Libraries.ToolControls.PmsSheet.PmsPublicData.SourceField) { _LabelSource.TrendLabelSource = node.Tag as PMS.Libraries.ToolControls.PmsSheet.PmsPublicData.SourceField; } else { MessageBox.Show(Properties.Resources.ResourceManager.GetString("message0009")); result = -1; return(result); } if (_LabelSource.FieldFlag == null) { _LabelSource.FieldFlag = new List <FieldLabel>(); } else { _LabelSource.FieldFlag.Clear(); } _LabelSource.LineColor = colorComBoBox1.SelectedItem; _LabelSource.LineWidth = System.Convert.ToInt32(numericUpDown1.Value); if (radioButton1.Checked) { _LabelSource.TextLineAlignment = StringAlignment.Near; } else if (radioButton2.Checked) { _LabelSource.TextLineAlignment = StringAlignment.Center; } else if (radioButton3.Checked) { _LabelSource.TextLineAlignment = StringAlignment.Far; } if (radioButton4.Checked) { _LabelSource.TextAlignment = StringAlignment.Near; } else if (radioButton5.Checked) { _LabelSource.TextAlignment = StringAlignment.Center; } else if (radioButton6.Checked) { _LabelSource.TextAlignment = StringAlignment.Far; } if (!string.IsNullOrEmpty(comboBox1.Text)) { _LabelSource.TextOrientation = (System.Windows.Forms.DataVisualization.Charting.TextOrientation)Enum.Parse(typeof(System.Windows.Forms.DataVisualization.Charting.TextOrientation), comboBox1.Text); } //必需有且只有一个基准字段 int _FieldNeeded = 0; foreach (DataGridViewRow row in DataField.Rows) { if (row.Cells[1].ValueType == typeof(bool)) { if (Convert.ToBoolean(row.Cells[1].Value) == true) { FieldLabel temp = new FieldLabel(); temp.CurrentField = row.Cells[0].Tag as PMS.Libraries.ToolControls.PmsSheet.PmsPublicData.SourceField; temp.IsFlag = true; if (row.Cells[3].Value != null) { temp.IsMainField = Convert.ToBoolean(row.Cells[3].Value); } else { temp.IsMainField = false; } if (row.Cells[4].Value != null) { temp.Format = row.Cells[4].Value.ToString(); } _LabelSource.FieldFlag.Add(temp); } object obj = row.Cells[3].Value; if (obj != null && Convert.ToBoolean(obj)) { ++_FieldNeeded; } } } if (_FieldNeeded != 1) { if (_FieldNeeded == 0) { MessageBox.Show(Properties.Resources.ResourceManager.GetString("message0011")); } else { MessageBox.Show(Properties.Resources.ResourceManager.GetString("message0012")); } result = -1; return(result); } } catch { result = -1; } return(result); }