本文整理汇总了C#中Shape.get_CellsSRC方法的典型用法代码示例。如果您正苦于以下问题:C# Shape.get_CellsSRC方法的具体用法?C# Shape.get_CellsSRC怎么用?C# Shape.get_CellsSRC使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shape
的用法示例。
在下文中一共展示了Shape.get_CellsSRC方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnShapeAdd
void OnShapeAdd(Shape shape)
{
ShapeTypes type = Common.GetShapeType(shape);
bool is1D = shape.OneD != 0;
// Tricky - when pasting, Visio gives out new uids to the shapes if there are duplicates
// in this document. So, we are going to stash the original ones - unless we are pasting.
// If we are pasting, the paste end will fix the ones that were added.
if (!visioControl.Document.Application.get_IsInScope((int)VisUICmds.visCmdUFEditPaste) &&
!visioControl.Document.Application.get_IsInScope((int)VisUICmds.visCmdUFEditDuplicate)) {
string uid = shape.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID);
string cached = Common.GetCellString(shape, Strings.CutCopyPasteTempCellName);
// when undoing a delete page, you can't write this yet so this check will ignore it
if (!uid.Equals(cached))
Common.SetCellString(shape, Strings.CutCopyPasteTempCellName, uid);
}
else if (Common.GetShapeType(shape) == ShapeTypes.OffPageRef) {
Common.ErrorMessage("Pasted off-page reference needs to be connected. Double click on it to repair.");
// Because these can be cut and pasted from a single document, clearing these fields
// allows us to avoid having more than one off page connector pointing to a single other one
// which causes issues with tracking things in the shadows. This way here, double clicking
// on the connector will ask which page to connect it to.
Common.SetCellString(shape, ShapeProperties.OffPageConnectorDestinationPageID, "");
Common.SetCellString(shape, ShapeProperties.OffPageConnectorDestinationShapeID, "");
}
if (type == ShapeTypes.None && is1D) {
// rogue connector - need to make it conform
Common.SetCellString(shape, ShapeProperties.ShapeType, ((int)ShapeTypes.Connector).ToString());
shape.get_CellsSRC((short)VisSectionIndices.visSectionObject,
(short)VisRowIndices.visRowLine,
(short)VisCellIndices.visLineEndArrow).FormulaU = "13";
shape.get_CellsSRC((short)VisSectionIndices.visSectionObject,
(short)VisRowIndices.visRowLine,
(short)VisCellIndices.visLineRounding).FormulaU = "0.25 in";
shape.get_CellsSRC((short)VisSectionIndices.visSectionObject,
(short)VisRowIndices.visRowLock,
(short)VisCellIndices.visLockTextEdit).FormulaU = "1";
// just in case
Common.FixConnectorTextControl(shape);
// make every row in the shape data section invisible
short row = (short)VisRowIndices.visRowFirst;
while (shape.get_CellsSRCExists((short)VisSectionIndices.visSectionProp, row, (short)VisCellIndices.visCustPropsInvis, (short)VisExistsFlags.visExistsAnywhere) != 0)
shape.get_CellsSRC((short)VisSectionIndices.visSectionProp, row++, (short)VisCellIndices.visCustPropsInvis).FormulaU = "TRUE";
}
// when a shape is copied and pasted, it will be an exact copy of the previous shape
// we need fix the duplicate name issue before we do anything else
string oldPastedStateName = String.Empty;
if (visioControl.Document.Application.get_IsInScope((int)VisUICmds.visCmdUFEditPaste) ||
visioControl.Document.Application.get_IsInScope((int)VisUICmds.visCmdUFEditDuplicate)) {
string stateId = Common.GetCellString(shape, ShapeProperties.StateId);
if (stateId.Length > 0) {
if (!StatePrefixAndNumberManager.IsStateIdOkayForUse(stateId)) {
oldPastedStateName = stateId;
// NEVER, NEVER do this without going through the shadow except here, before the shadow is made
Common.SetCellString(shape, ShapeProperties.StateId, String.Empty);
}
}
}
Shadow shadow = Common.MakeShapeShadow(shape);
if (shadow != null) {
// if we have a pasted name that conflicted, this will reuse the name portion
// but get us a new prefix and number and then renumber any prompts
if (oldPastedStateName.Length > 0) {
string prefix, number, name;
StateShadow.DisectStateIdIntoParts(oldPastedStateName, out prefix, out number, out name);
shape.Text = StateShadow.StateIdForDisplay(name).Trim();
// this just pretends we just typed the name portion into the shape itself
shadow.OnShapeExitTextEdit();
// and now let's renumber any prompts if we're not using the "number" option
List<Shadow> shadowList = LookupShadowsByShapeType(ShapeTypes.Start);
if (shadowList.Count > 0) {
StartShadow startShadow = shadowList[0] as StartShadow;
string promptIdFormat = startShadow.GetDefaultSetting(Strings.DefaultSettingsPromptIDFormat);
if (promptIdFormat.Equals(Strings.PromptIdFormatFull) || promptIdFormat.Equals(Strings.PromptIdFormatPartial)) {
StateShadow stateShadow = shadow as StateShadow;
if (stateShadow != null)
stateShadow.RedoPromptIds(0, promptIdFormat);
}
}
}
shadowShapeMap.Add(shape.get_UniqueID((short)VisUniqueIDArgs.visGetOrMakeGUID), shadow);
shadow.OnShapeAdd();
if (shadow.GetShapeType() == ShapeTypes.DocTitle ||
shadow.GetShapeType() == ShapeTypes.ChangeLog ||
shadow.GetShapeType() == ShapeTypes.Start) {
if (LookupShadowsByShapeType(shadow.GetShapeType()).Count > 1) {
Common.ErrorMessage("Cannot have two Start, Change Log, or Document Title shapes");
Common.ForcedSetShapeText(shape, Strings.ToBeDeletedLabel);
}
}
}
else {
//.........这里部分代码省略.........
示例2: SetRowLabel
private static void SetRowLabel(Shape shape, string rowName, string label)
{
if (shape.get_CellExists(rowName, (short)VisExistsFlags.visExistsAnywhere) != 0) {
Cell c = shape.get_Cells(rowName);
Cell cSRC = shape.get_CellsSRC((short)VisSectionIndices.visSectionProp, c.Row, (short)VisCellIndices.visCustPropsLabel);
cSRC.FormulaU = Common.StringToFormulaForString(label);
}
}
示例3: AddRightMouseAction
/// <summary>This method adds a right mouse action to a shape. The
/// right mouse action is added to the Actions section of the given
/// shape.</summary>
/// <param name="targetShape">Shape to add the action item to.</param>
/// <param name="menuCaption">Caption for the newly created menu item.
/// </param>
/// <param name="menuAction">Action to be taken when the menu item is
/// selected. This is a formula in universal syntax.</param>
/// <param name="menuEnabled">Initial enabled state of the menu item.
/// </param>
/// <param name="menuChecked">Initial checked state of the menu item.
/// </param>
/// <param name="beginGroup">display a divider bar above the command
/// in the menu.</param>
/// <param name="addToBottom">display the command at the bottom of the
/// menu.</param>
private static void AddRightMouseAction(Shape targetShape, string menuCaption, string menuAction,
bool menuEnabled, bool menuChecked, bool beginGroup, bool addToBottom)
{
const string DividerBarPrefix = "_";
const string AddToBottomPrefix = "%";
const string AcceleratorPrefix = "&";
if (menuCaption == null || targetShape == null)
return;
short actionRow;
short actionRows;
string taggedMenuCaption;
string rowCaption;
string cleanMenuCaption;
Cell actionCell;
try {
// the menuCaption string may need to be modified to include a
// tag that indicates the menu should be at the bottom, or
// should be preceeded by a separator line.
taggedMenuCaption = menuCaption;
if (taggedMenuCaption == null)
throw new ArgumentNullException("Menu caption is null");
// strip modifier tokens from the caption
cleanMenuCaption = menuCaption.Replace(AcceleratorPrefix, "");
// Check if the right menu action item already exists.
actionRows = targetShape.get_RowCount((short)VisSectionIndices.visSectionAction);
bool actionExists = false;
for (actionRow = 0; (actionExists == false) && (actionRow < actionRows); actionRow++) {
actionCell = targetShape.get_CellsSRC((short)VisSectionIndices.visSectionAction,
(short)(VisRowIndices.visRowAction + actionRow),
(short)VisCellIndices.visActionMenu);
rowCaption = Common.FormulaStringToString(actionCell.FormulaU);
// strip modifier tokens from the caption before compare
rowCaption = rowCaption.Replace(DividerBarPrefix, "");
rowCaption = rowCaption.Replace(AddToBottomPrefix, "");
rowCaption = rowCaption.Replace(AcceleratorPrefix, "");
if (rowCaption == cleanMenuCaption)
actionExists = true;
}
if (actionExists == false) {
// prefix underscore (_) to the caption to add a separator
// line above it.
if (beginGroup == true && taggedMenuCaption != null)
taggedMenuCaption = taggedMenuCaption.Insert(0, DividerBarPrefix);
// prefix percent (%) to the caption to add it to the
// bottom of the menu.
if (addToBottom == true)
taggedMenuCaption = taggedMenuCaption.Insert(0, AddToBottomPrefix);
// Add a new action row to the shape.
actionRow = targetShape.AddRow((short)VisSectionIndices.visSectionAction,
(short)VisRowIndices.visRowLast,
(short)VisRowIndices.visRowAction);
// Set the menu caption.
actionCell = targetShape.get_CellsSRC((short)VisSectionIndices.visSectionAction,
actionRow,
(short)VisCellIndices.visActionMenu);
actionCell.FormulaU = Common.StringToFormulaForString(taggedMenuCaption);
// Set the action for the menu item.
actionCell = targetShape.get_CellsSRC((short)VisSectionIndices.visSectionAction,
actionRow,
(short)VisCellIndices.visActionAction);
actionCell.FormulaU = menuAction;
// Set the menu item's enabled/disabled state.
actionCell = targetShape.get_CellsSRC((short)VisSectionIndices.visSectionAction,
actionRow,
(short)VisCellIndices.visActionDisabled);
actionCell.set_ResultFromInt(VisUnitCodes.visNumber,
Convert.ToInt32(!menuEnabled, System.Globalization.CultureInfo.InvariantCulture));
//.........这里部分代码省略.........
示例4: RemoveRightMouseAction
// Removes the action associated with using the right mouse on a shape
private static void RemoveRightMouseAction(Shape targetShape, string menuCaption)
{
const string DividerBarPrefix = "_";
const string AddToBottomPrefix = "%";
const string AcceleratorPrefix = "&";
if (menuCaption == null || targetShape == null)
return;
short actionRow;
short actionRows;
string taggedMenuCaption;
string rowCaption;
string cleanMenuCaption;
Cell actionCell;
try {
// the menuCaption string may need to be modified to include a
// tag that indicates the menu should be at the bottom, or
// should be preceeded by a separator line.
taggedMenuCaption = menuCaption;
if (taggedMenuCaption == null)
throw new ArgumentNullException("Menu caption is null");
// strip modifier tokens from the caption
cleanMenuCaption = menuCaption.Replace(AcceleratorPrefix, "");
// Check if the right menu action item already exists.
actionRows = targetShape.get_RowCount((short)VisSectionIndices.visSectionAction);
bool actionExists = false;
for (actionRow = 0; (actionExists == false) && (actionRow < actionRows); actionRow++) {
actionCell = targetShape.get_CellsSRC((short)VisSectionIndices.visSectionAction,
(short)(VisRowIndices.visRowAction + actionRow),
(short)VisCellIndices.visActionMenu);
rowCaption = Common.FormulaStringToString(actionCell.FormulaU);
// strip modifier tokens from the caption before compare
rowCaption = rowCaption.Replace(DividerBarPrefix, "");
rowCaption = rowCaption.Replace(AddToBottomPrefix, "");
rowCaption = rowCaption.Replace(AcceleratorPrefix, "");
if (rowCaption == cleanMenuCaption) {
targetShape.DeleteRow((short)VisSectionIndices.visSectionAction, (short)(VisRowIndices.visRowAction + actionRow));
actionExists = true;
}
}
}
catch (System.Runtime.InteropServices.COMException err) {
System.Diagnostics.Debug.WriteLine(err.Message);
}
}
示例5: LockShapeText
internal static void LockShapeText(Shape shape)
{
shape.get_CellsSRC((short)VisSectionIndices.visSectionObject,
(short)VisRowIndices.visRowLock,
(short)VisCellIndices.visLockTextEdit).FormulaU = "1";
}
示例6: ForcedSetShapeText
// Overrides the lock (which may or may not be set) and sets the shape text
internal static void ForcedSetShapeText(Shape shape, string text)
{
Cell cell = shape.get_CellsSRC((short)VisSectionIndices.visSectionObject,
(short)VisRowIndices.visRowLock,
(short)VisCellIndices.visLockTextEdit);
string oldSetting = cell.FormulaU;
cell.FormulaU = "0";
shape.Text = text;
cell.FormulaU = oldSetting;
}