下面的代码将帮助您入门,或者您随时可以查看我们有关图形注释的完整教程 。我们还将介绍 如何 为您的文档或图像创建自定义注释。
private void Form1_Load(object sender, EventArgs e){// Initialize Image Viewer objectviewer = new ImageViewer();viewer.Dock = DockStyle.Fill;// Initialize Automation Control for Image ViewerautomationControl = new ImageViewerAutomationControl();automationControl.ImageViewer = viewer;// Initialize a new RasterCodecs objectRasterCodecs codecs = new RasterCodecs();// Load the main image into the viewerviewer.Image = codecs.Load(@"C:LEADTOOLS21ResourcesImagesocr1.tif");// Initialize the Interactive Mode for the Image ViewerAutomationInteractiveMode automationInteractiveMode = new AutomationInteractiveMode();automationInteractiveMode.AutomationControl = automationControl;// Add the Interactive Mode to the Image Viewerviewer.InteractiveModes.BeginUpdate();viewer.InteractiveModes.Add(automationInteractiveMode);viewer.InteractiveModes.EndUpdate();if (viewer.Image != null){// Create and set up the Automation ManagerannAutomationManager = new AnnAutomationManager();annAutomationManager.RestrictDesigners = true;// Instruct the Manager to create all the default Automation objects.annAutomationManager.CreateDefaultObjects();// Initialize the Manager Helper and create the Toolbar// Add the Toolbar and the Image Viewer to the ControlsAutomationManagerHelper managerHelper = new AutomationManagerHelper(annAutomationManager);managerHelper.CreateToolBar();Controls.Add(managerHelper.ToolBar);Controls.Add(viewer);// Set up the Automation (it will create the Container as well)automation = new AnnAutomation(annAutomationManager, automationControl);// Set this Automation as the active oneautomation.Active = true;// Set the size of the Container to the size of the Image Viewerautomation.Container.Size =automation.Container.Mapper.SizeToContainerCoordinates(LeadSizeD.Create(viewer.Image.ImageWidth,viewer.Image.ImageHeight));}}
要自己进行测试,请确保下载最新的LEADTOOLS SDK评估( 如果尚未下载)。该试用版有效期为60天,并提供无限制的聊天和电子邮件支持。
试用版下载>>>
LEADTOOLS 使用教程>>>
想要购买LEADTOOLS正版授权,或了解更多产品信息请点击【咨询在线客服】
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!