我很菜鸟WPF。我创建一个WPF应用程序,使用EmguCV库image Processing。我发现我不能ImageBox在WPF. 所以我用NamedWindow来显示image然后我决定用Image Control来显示window. 我想提请rectangle在那image,但矩形在其他地方没有画出。所以谁能告诉我代码中有什么问题。基本上我想获取该图像的投资回报率。编辑:- 我把Canvas里面grid放了Image Control里面Canvas**我的 XAML 代码 **<Grid Margin="0,0,2,-1"> <Grid.ColumnDefinitions> <ColumnDefinition Width="138*"/> <ColumnDefinition Width="139*"/> </Grid.ColumnDefinitions> <Button x:Name="button" Content="Convert" Margin="139.053,432.066,0,0" Click="button_Click" Height="27.934" VerticalAlignment="Top" HorizontalAlignment="Left" Width="113.947" Grid.Column="1"/> <Button x:Name="button1" Content="Load Palette" Margin="308,432.066,0,0" Click="button1_Click_1" Height="27.934" VerticalAlignment="Top" HorizontalAlignment="Left" Width="75" Grid.ColumnSpan="2"/> <Button x:Name="button2" Content="Load Gray Image" Margin="48,432.066,0,0" Click="button2_Click" Height="27.934" VerticalAlignment="Top" HorizontalAlignment="Left" Width="104"/> <Canvas x:Name="MyCanvas" Margin="81,86.5,27.245,120.5" Grid.Column="1"> <Image x:Name="image3" Height="263" Width="238"/> </Canvas> <Image x:Name="image1" HorizontalAlignment="Left" Height="263" Margin="10,86.5,0,0" VerticalAlignment="Top" Width="255.5"/> <Image x:Name="image2" Grid.ColumnSpan="2" HorizontalAlignment="Left" Height="393" Margin="308,10,0,0" VerticalAlignment="Top" Width="75"/></Grid>我使用Event Handler过Canvas,但它不显示rectangle提前致谢
1 回答
千万里不及你
TA贡献1784条经验 获得超9个赞
我得到了答案,实际上我还没有添加事件处理程序,image3 Image Control这就是它不显示输出的原因。
<Canvas x:Name="MyCanvas" Margin="81,86.5,27.245,120.5" Grid.Column="1">
<Image x:Name="image3" Height="263" Width="238" MouseLeftButtonDown="image3_MouseLeftButtonDown" MouseLeftButtonUp="image3_MouseLeftButtonUp" MouseMove="image3_MouseMove"/>
</Canvas>
- 1 回答
- 0 关注
- 148 浏览
添加回答
举报
0/150
提交
取消