.net6 prism wpf 8.1使用 halcondotnet 程序集
1、nuget安装HalconDotNet包

2、报错 System.Drawing.Common问题
nuget安装包 System.Drawing.Common

3、wpf使用halcondotnet.dll 程序集

<UserControl x:Class="HalconDemoTest.Modules.ModuleName.Views.ViewA" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:HalconDemoTest.Modules.ModuleName.Views" xmlns:prism="http://prismlibrary.com/" xmlns:HalconDotNet="clr-namespace:HalconDotNet;assembly=halcondotnet" prism:ViewModelLocator.AutoWireViewModel="True"> <Grid> <HalconDotNet:HSmartWindowControlWPF Name="WindowControl" Width="{Binding ElementName=WidthSlider, Path=Value}" Height="600" Loaded="HSmartWindowControlWPF_Loaded" Grid.Row="1" Grid.Column="1" /> </Grid> </UserControl>
using HalconDotNet; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace HalconDemoTest.Modules.ModuleName.Views { /// <summary> /// Interaction logic for ViewA.xaml /// </summary> public partial class ViewA : UserControl { public ViewA() { InitializeComponent(); } private void HSmartWindowControlWPF_Loaded(object sender, RoutedEventArgs e) { var pictureCtrl = sender as HSmartWindowControlWPF; HImage img = new HImage("1.png"); pictureCtrl.HalconWindow.DispImage(img); } } }
4、显示
记得设置图片的位置

5、其他 halcon官方的wpf示例目录:
C:\Users\Public\Documents\MVTec\HALCON-17.12-Progress\examples\c#


 
                    
                     
                    
                 
                    
                
 
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号