简体   繁体   English

如何检查不同picBox中的图片是否相同? C#Windows窗体

[英]How to check if pictures in different picBoxes are the same? c# windows form

I'm doing a quiz for Course Work and I have 15 PicBoxes of letter and 6 empty PicBoxes, and I have the picBox letters (they're from the resources) to enter the empty ones in order as they are clicked but I don't know how to check if the letters are in the order that I want them to be for the answer. 我正在对课程工作进行测验,我有15个字母的PicBox和6个空的PicBox,并且我有picBox字母(它们来​​自资源)可以在单击时按顺序输入空字母,但是我没有不知道如何检查字母的顺序是否符合我希望它们作为答案的顺序。

I tried this: 我尝试了这个:

if ((picAns1.Image == picLetter2.Image) && (picAns2.Image == picLetter10.Image)

I'm probably just trying to overthink it but I need help please. 我可能只是想想一下,但是请帮忙。

The easier solution I can think of would be to use PictureBox 's Tag property to define some easily comparable values. 我能想到的更简单的解决方案是使用PictureBoxTag属性来定义一些易于比较的值。 When you fill all 6 empty boxes check if it's sorted in order you define. 当您填写所有6个空白框时,请检查是否按定义的顺序对其进行了排序。

So if you have letters on those images, just give each PictureBox a string tag representing a letter on that image and at the end go through them and find out if they are in the alphabetical order. 因此,如果这些图像上有字母,只需给每个PictureBox一个字符串标签,代表该图像上的字母,最后遍历它们,找出它们是否按字母顺序排列。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我如何从C#中同一项目下的不同Windows窗体访问不同的组件? - How can i access the different component from different windows form which are under same project in c#? C#:检查Windows窗体是否 - C#: Check if windows form 我如何检查C#Windows应用程序中的窗体是否打开? - How can i check form is open in c# windows application? 如何检查和禁用 C# windows 表单中的 flowLayoutPanel 控件? - How to check and disable flowLayoutPanel controls in C# windows form? 如何检查Windows Phone 7和C#中两个图像的来源是否相同? - how to check if sources of two images are same in Windows Phone 7 and C#? 相同的C#Windows Form应用程序从不同的打印机获得不同的打印尺寸 - Different print dimensions from different printers by same C# Windows Form Application 不同Windows形式的C#类的对象 - C# object of class in different windows form 如何在 c# windows 表单中将组合框与 2 个不同的表绑定 - How to bind combox with 2 different tables in c# windows form C#-检查DataTable表单的相同字段 - C# - Check DataTable form same field vsto:使用C#在相同的解决方案中从Windows窗体应用程序迁移不同的excel工作簿 - vsto: Caling different excel workbooks from windows form application in same solutions using c#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM