hwindow = hSmartWindowControl1.HalconWindow;//初始化窗口变量
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Orientation="Vertical">
<Button Width="75" Height="25" Content="LoadImg" Margin="2.5" Click="Button_Click"></Button>
<CheckBox Content="Rect" Margin="2.5" x:Name="rect_roi" Checked="rect_roi_Checked" Unchecked="rect_roi_Unchecked"></CheckBox>
<CheckBox Content="Ellipse" Margin="2.5" x:Name="ellipse_roi" Checked="ellipse_roi_Checked" Unchecked="ellipse_roi_Unchecked"></CheckBox>
</StackPanel>
<halcon:HSmartWindowControlWPF HKeepAspectRatio="True" Grid.Column="1" x:Name="HalconWindowControl" HInitWindow="HWind_HInitWindow"></halcon:HSmartWindowControlWPF>
<Canvas x:Name="Canvas" Visibility="Collapsed" Grid.Column="1" Background="Transparent" MouseLeftButtonDown="Canvas_MouseLeftButtonDown" MouseUp="Canvas_MouseUp" MouseMove="Canvas_MouseMove"></Canvas>
</Grid>