private static void SetShapeFromArrowCheckBox(CheckBox checkBox, Shape shape) { if (checkBox.Checked == true) { shape.get_Cells("BeginArrow").FormulaU = "1"; shape.get_Cells("EndArrow").FormulaU = "1"; } else { shape.get_Cells("BeginArrow").FormulaU = "0"; shape.get_Cells("EndArrow").FormulaU = "0"; } }
private static void SetCheckBoxFromShape(CheckBox checkBox, Shape shape, string cellName) { if (shape.get_Cells(cellName).FormulaU.Equals("TRUE")) checkBox.Checked = false; else checkBox.Checked = true; }
public static string ReadANamedCustomProperty(Microsoft.Office.Interop.Visio.Shape customPropertyShape, string cellName, bool isLocalName) { Microsoft.Office.Interop.Visio.Cell customPropertyCell = null; if (customPropertyShape != null || cellName != null) { const string CUST_PROP_PREFIX = "Prop."; string propName; try { if (cellName.Length == 0) { throw new System.ArgumentNullException("cellName", "Zero length string input."); } propName = CUST_PROP_PREFIX + cellName; if (isLocalName) { if (customPropertyShape.get_CellExists(propName, (short)Microsoft.Office.Interop.Visio.VisExistsFlags.visExistsAnywhere) != 0) { customPropertyCell = customPropertyShape.get_Cells(propName); } } else if (customPropertyShape.get_CellExistsU(propName, (short)Microsoft.Office.Interop.Visio.VisExistsFlags.visExistsAnywhere) != 0) { customPropertyCell = customPropertyShape.get_CellsU(propName); } } catch (Exception err) { System.Windows.Forms.MessageBox.Show(err.Message); throw; } } return((customPropertyCell != null) ? customPropertyCell.get_ResultStr(Microsoft.Office.Interop.Visio.VisUnitCodes.visNoCast) : ""); }
private static void SetShapeFromCheckBox(CheckBox checkBox, Shape shape, string cellName) { if (checkBox.Checked == true) shape.get_Cells("HideText").FormulaU = "FALSE"; else shape.get_Cells("HideText").FormulaU = "TRUE"; }
/// <summary> /// Sets the shape text on a Tab shape. /// </summary> /// <param name="text">Text to show.</param> protected override void SetShapeText(string text) { try { XmlNode labelSpanNode = null; string labelSpanValue = labelSpanDefault; int labelSpan; if (base.GetProperties() != null) { labelSpanNode = base.GetProperties().SelectSingleNode("//labelSpan"); if (labelSpanNode != null) { labelSpanValue = labelSpanNode.InnerText; } try { labelSpan = int.Parse(labelSpanValue); if (labelSpan < 1) { labelSpanValue = labelSpanDefault; } } catch (Exception) { labelSpanValue = labelSpanDefault; } } bool writeText = false; // BEGIN_HAMMER Control c = (Control)Form["columns"]; if (c == null) { c = (Control)Form["items"]; if (c != null) { writeText = true; } } if (c == null) { c = (Control)Form["tabs"]; } // END_HAMMER ListBox lb = (ListBox)c.Controls[5]; int count = lb.Items.Count; int index, min, max; // Mostra por defeito 3 elementos (para o caso de ser populado por uma lov) int cnt = lb.Items.Count; if (cnt == 0) { cnt = 3; } VisioUtils.SetProperty(VisioShape, "Prop", "ValidItems", lb.Items.Count.ToString()); min = count + 1; max = columnsXMax + 1; for (index = min; index < max; index++) { VisShape center = VisioShape.Shapes[index]; center.get_Cells("LockTextEdit").ResultIU = 0; center.Text = string.Empty; center.get_Cells("LockTextEdit").ResultIU = 1; } for (index = 1; index < min; index++) { VisShape center = VisioShape.Shapes[index]; center.get_Cells("LockTextEdit").ResultIU = 0; Object obj = lb.Items[index - 1]; center.Text = obj.ToString(); center.get_Cells("LockTextEdit").ResultIU = 1; } if (writeText) { for (int i = 1; i <= VisioShape.Shapes.Count; i++) { VisShape center = VisioShape.Shapes[i]; int isInput = VisioUtils.GetPropertyInt(center, "Prop", "Label"); if (isInput > 0) { if (labelSpanValue != null) { VisioUtils.SetProperty(center, "User", "LabelLen", labelSpanValue); } center.get_Cells("LockTextEdit").ResultIU = 0; center.Text = text; center.get_Cells("LockTextEdit").ResultIU = 1; i = VisioShape.Shapes.Count + 1; } } } } catch (FormatException) { ESIMessageBox.ShowError(Resources.GetString(ResourceTokens.ShapeTableColumns)); } }