publicvirtualvoidLock()
PublicOverridableSubLock()
-(void) lock;
publicvoidlock()
public:
virtualvoidLock()
Use theCanLockproperty to determine whether you can currently call this method.
For more information, refer to我mplementing Annotation Security.
This example will show how to lock and unlock an object, prompting the user for a password.
usingLeadtools.Annotations.Automation;
usingLeadtools.Annotations.Engine;
usingLeadtools.Codecs;
usingLeadtools.Controls;
usingLeadtools.Annotations.Rendering;
usingLeadtools.Annotations.WinForms;
publicvoidAnnAutomation_Lock()
{
// first add a new object to the automation
AnnRectangleObject rectObj =newAnnRectangleObject();
rectObj.Rect = LeadRectD.Create(100, 100, 800, 800);
rectObj.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create("Blue"), LeadLengthD.Create(1));
rectObj.Fill = AnnSolidColorBrush.Create("Yellow");
_automation.Container.Children.Add(rectObj);
_automation.Invalidate(LeadRectD.Empty);
// make sure no objects are selected in the automation
_automation.SelectObject(null);
// Hook to the lock and unlock events
_automation.LockObject += _automation_LockObject;
_automation.UnlockObject += _automation_UnlockObject;
// see if we can lock or unlock the object (this should show a message informing you that no objects are currently selected (bring edited)
LockUnlock(_automation);
// select (edit) the object we have just added
_automation.SelectObject(rectObj);
// see if we can lock or unlock the object (should show the password dialog to lock the object)
LockUnlock(_automation);
_automation.LockObject -= _automation_LockObject;
_automation.UnlockObject -= _automation_UnlockObject;
}
privatevoidLockUnlock(AnnAutomation automation)
{
// first, check if we can lock the object
if(automation.CanLock)
{
// lock this object
automation.Lock();
}
elseif(automation.CanUnlock)
{
// unlock this object
automation.Unlock();
}
else
{
Debug.WriteLine("Cannot lock or unlock because no object is currently being edited (selected)");
}
}
void_automation_LockObject(objectsender, AnnLockObjectEventArgs e)
{
Debug.WriteLine(string.Format("Lock it, sending password = {0}","secret"));
e.Password ="secret";
}
void_automation_UnlockObject(objectsender, AnnLockObjectEventArgs e)
{
Debug.WriteLine(string.Format("Unlock it, sending password = {0}","secret"));
e.Password ="secret";
}
Help Collections
Raster.NET|C API|C++ Class Library|HTML5 JavaScript
Document.NET|C API|C++ Class Library|HTML5 JavaScript
Medical.NET|C API|C++ Class Library|HTML5 JavaScript
Medical Web Viewer.NET
188宝金博怎么下载
Media Foundation.NET|C API|Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
我maging, Medical, and Document
C API/C++ Class Libraries
我maging, Medical, and Document
HTML5 JavaScript Libraries
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.