[英]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. 我能想到的更简单的解决方案是使用
PictureBox
的Tag
属性来定义一些易于比较的值。 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.