LEADTOOLS Annotations for WPF and Silverlight (Leadtools.Windows.Annotations assembly)
LEAD Technologies, Inc

StartEditing Method

Example 





An existing AnnObject to edit.
true to group this annObject with the object(s) currently being edited if(any); false otherwise.
Starts editing the given AnnObject. .NET support Silverlight support
Syntax
public virtual void StartEditing( 
   AnnObject annObject,
   bool group
)
'Declaration
 
Public Overridable Sub StartEditing( _
   ByVal annObject As AnnObject, _
   ByVal group As Boolean _
) 
'Usage
 
Dim instance As AnnAutomation
Dim annObject As AnnObject
Dim group As Boolean
 
instance.StartEditing(annObject, group)
public virtual void StartEditing( 
   AnnObject annObject,
   bool group
)
 function Leadtools.Windows.Annotations.AnnAutomation.StartEditing( 
   annObject ,
   group 
)
public:
virtual void StartEditing( 
   AnnObject^ annObject,
   bool group
) 

Parameters

annObject
An existing AnnObject to edit.
group
true to group this annObject with the object(s) currently being edited if(any); false otherwise.
Remarks

This method is called by the AnnAutomation object in design user mode whenever an object is "selected" (by clicking it with the mouse usually). You can manually start the editing process of an object by calling this method.

If you have object(s) that are currently being edited in this AnnAutomation and you want to either create a new group or add an annObject to the group currently being edited, then pass true for group; otherwise pass false. Passing true when no objects are currently being edited will not create a new group and edits this object individually as normal. Passing false when objects are currently being edited will cause the current editing operation to be canceled and start a new one for annObject.

Example
Copy CodeCopy Code  
Private Sub AnnAutomation_StartEditing(ByVal manager As AnnAutomationManager)
   ' find the active automation
   Dim automation As AnnAutomation = Nothing
   Dim index As Integer = 0
   Do While index < manager.Automations.Count AndAlso automation Is Nothing
      If manager.Automations(index).Active Then
         automation = manager.Automations(index)
      End If
      index += 1
   Loop
   If Not automation Is Nothing Then
      ' add a new rectangle object to this automation
      Dim rectObj As AnnRectangleObject = New AnnRectangleObject()
      rectObj.Rect = New Rect(100, 100, 200, 200)
      rectObj.Stroke = Colors.Blue
      rectObj.StrokeThickness = 2.0
      rectObj.Fill = Colors.Yellow

      ' surround the changes to the automation by an undo
      automation.BeginUndo()

      automation.Container.Children.Add(rectObj)

      ' "select" this rectangle and make it ready for editing
      automation.StartEditing(rectObj, False)

      automation.EndUndo()
   End If
End Sub
private void AnnAutomation_StartEditing(AnnAutomationManager manager)
{
   // find the active automation
   AnnAutomation automation = null;
   for(int index = 0; index < manager.Automations.Count && automation == null; index++)
   {
      if(manager.Automations[index].Active)
         automation = manager.Automations[index];
   }
   if(automation != null)
   {
      // add a new rectangle object to this automation
      AnnRectangleObject rectObj = new AnnRectangleObject();
      rectObj.Rect = new Rect(100, 100, 200, 200);
      rectObj.Stroke = Colors.Blue;
      rectObj.Fill = Colors.Yellow;
      rectObj.StrokeThickness = 2.0;

      // surround the changes to the automation by an undo
      automation.BeginUndo();

      automation.Container.Children.Add(rectObj);

      // "select" this rectangle and make it ready for editing
      automation.StartEditing(rectObj, false);

      automation.EndUndo();
   }
}
private void AnnAutomation_StartEditing(AnnAutomationManager manager)
{
   // find the active automation
   AnnAutomation automation = null;
   for(int index = 0; index < manager.Automations.Count && automation == null; index++)
   {
      if(manager.Automations[index].Active)
         automation = manager.Automations[index];
   }
   if(automation != null)
   {
      // add a new rectangle object to this automation
      AnnRectangleObject rectObj = new AnnRectangleObject();
      rectObj.Rect = new Rect(100, 100, 200, 200);
      rectObj.Stroke = Colors.Blue;
      rectObj.Fill = Colors.Yellow;
      rectObj.StrokeThickness = 2.0;

      // surround the changes to the automation by an undo
      automation.BeginUndo();

      automation.Container.Children.Add(rectObj);

      // "select" this rectangle and make it ready for editing
      automation.StartEditing(rectObj, false);

      automation.EndUndo();
   }
}
Private Sub AnnAutomation_StartEditing(ByVal manager As AnnAutomationManager)
   ' find the active automation
   Dim automation As AnnAutomation = Nothing
   Dim index As Integer = 0
   Do While index < manager.Automations.Count AndAlso automation Is Nothing
      If manager.Automations(index).Active Then
         automation = manager.Automations(index)
      End If
      index += 1
   Loop
   If Not automation Is Nothing Then
      ' add a new rectangle object to this automation
      Dim rectObj As AnnRectangleObject = New AnnRectangleObject()
      rectObj.Rect = New Rect(100, 100, 200, 200)
      rectObj.Stroke = Colors.Blue
      rectObj.Fill = Colors.Yellow
      rectObj.StrokeThickness = 2.0

      ' surround the changes to the automation by an undo
      automation.BeginUndo()

      automation.Container.Children.Add(rectObj)

      ' "select" this rectangle and make it ready for editing
      automation.StartEditing(rectObj, False)

      automation.EndUndo()
   End If
End Sub
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

AnnAutomation Class
AnnAutomation Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.