在Ranorex里面使用图像比较来查找对象,可以使用contains方法
C#
// Create bitmap
Bitmap bmp = Ranorex.Imaging.Load(
@”..\..\Green Sea Turtle Small.bmp”);
// Search for it within the application window
if (Ranorex.Imaging.Contains(myRepo.WinFormsApp.Self,bmp) == true)
{
Report.Success(“Image found within WinForms application”);
}
VB.NET
‘ Create bitmap
Dim bmp As Bitmap = Ranorex.Imaging.Load(“..\..\Green Sea Turtle Small.bmp”)
‘ Search for it within the application window
If Imaging.Contains(myRepo.WinFormsApp.Self,bmp Then
Report.Success(“Image found within WinForms application”)
End If
注意:两个例子都是加载为压缩的图像(BMP, PNG格式)来进行一对一的比较。使用FindOption类可以来定义相似性等其他属性。