Locks this AnnObject with the specified password.
AnnObject.prototype.lock = function(
password
)
lock(
password: string
): void;
password
String containing the password used to lock the annotation object.
Only unlocked objects can be locked. If an object is already locked, it will stay locked with its original password. You must pass the same password to Unlock to unlock this AnnObject.
If this method succeeds, password will be stored inside the object and can be retrieved with the Password property.
An object must be unlocked in order to change that object in automated mode.
For more information, refer to Implementing Annotation Security.
example: function SiteLibrary_DefaultPage$example() {
var inch = 720.0;
// Get the container
var container = this._automation.get_container();
// Add the lock picture to the container resources
// Create a new instance of AnnResources if the container does not already have one
var resources = this._automation.get_container().get_resources();
if (resources == null) {
resources = new lt.Annotations.Core.AnnResources();
this._automation.get_container().set_resources(resources);
}
// Get the images collection
var imagesResources = resources.get_images();
// Add our picture to it
imagesResources.add(new lt.Annotations.Core.AnnPicture("Resources/Lock.png"));
var pictureIndex = imagesResources.length - 1;
// Add a blue on yellow rectangle from 3in 3in to 4in 4in
var rectObj = new lt.Annotations.Core.AnnRectangleObject();
rectObj.set_rect(lt.LeadRectD.create(3 * inch, 3 * inch, 1 * inch, 1 * inch));
rectObj.set_stroke(lt.Annotations.Core.AnnStroke.create(lt.Annotations.Core.AnnSolidColorBrush.create("blue"), lt.LeadLengthD.create(1)));
rectObj.set_fill(lt.Annotations.Core.AnnSolidColorBrush.create("yellow"));
// Set its lock picture
rectObj.set_lockPicture(pictureIndex);
// Add it to the container
container.get_children().add(rectObj);
// Show the object lock state (default)
alert("Default lock state");
this.showLockedState(rectObj);
// Lock it with a password
alert("Locking now with a password");
rectObj.lock("secret");
// Show the object lock state, it should say locked and the object should be painted with the lock picture
this.showLockedState(rectObj);
// Now try to unlock it with a wrong password
alert("Unlocking with a wrong password");
rectObj.unlock("wrong password");
// Check again, it should still be locked
this.showLockedState(rectObj);
// Finally unlock it with the correct password
alert("Unlocking with a correct password");
rectObj.unlock("secret");
// Check again, it should still be unlocked
this.showLockedState(rectObj);
},
showLockedState: function SiteLibrary_DefaultPage$showLockedState(annObj) {
this._automation.invalidate(lt.LeadRectD.get_empty());
// Show the object lock state (default)
alert("Locked: " + annObj.get_isLocked());
},
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET