'赤赤赤赤 '青青白白 '緑緑緑白 Dim pixAry As Integer(,) = New Integer(,) { _ {&H0000FF,&H0000FF,&H0000FF,&H0000FF} _ , {&HFF0000,&HFF0000,&HFFFFFF,&HFFFFFF} _ , {&H00FF00,&H00FF00,&H00FF00,&HFFFFFF} _ }
'スクリーン内を検索して、色を示す2次元配列とマッチしたスクリーン座標値をPoint構造体で返します Dim instance As ScreenHwnd Dim pixAry As Integer(,) Dim returnValue As System.Drawing.Point 'Overloads returnValue = instance.ImageSearchScreen(pixAry)
'スクリーン内の指定した四方の幅を除く範囲を検索して '色を示す2次元配列とマッチしたスクリーン座標値をPoint構造体で返します Dim instance As ScreenHwnd Dim pixAry As Integer(,) Dim offsetLeft As Integer Dim offsetTop As Integer Dim offsetRight As Integer Dim offsetBottom As Integer Dim returnValue As System.Drawing.Point 'Overloads returnValue _ = instance.ImageSearchScreen(pixAry, offsetLeft, offsetTop, offsetRight, offsetBottom)
'ScreenHwndクラス ImageSearchScreenメソッド Imports System.Windows.Forms Imports System.Drawing Public Class AddIn Private shw As ScreenHwnd Public Sub New() shw = New ScreenHwnd() End Sub Public Sub AddIn_Start() Dim pixAry As Integer(,) = New Integer(,) { _ {&H0000FF,&H0000FF,&H0000FF,&H0000FF} _ , {&HFF0000,&HFF0000,&HFFFFFF,&HFFFFFF} _ , {&H00FF00,&H00FF00,&H00FF00,&HFFFFFF} _ } Dim result As Point = shw.ImageSearchScreen(pixAry) If result.X <> -1 Then MessageBox.Show("画像位置X:" & result.X.ToString & " Y:" & result.Y.ToString) Else MessageBox.Show("画像は見つかりませんでした") End If End Sub End Class
'ScreenHwndクラス ImageSearchScreenメソッド Imports System.Windows.Forms Imports System.Drawing Public Class AddIn Private shw As ScreenHwnd Public Sub New() shw = New ScreenHwnd() End Sub Public Sub AddIn_Start() Dim pixAry As Integer(,) = New Integer(,) { _ {&H0000FF,&H0000FF,&H0000FF,&H0000FF} _ , {&HFF0000,&HFF0000,&HFFFFFF,&HFFFFFF} _ , {&H00FF00,&H00FF00,&H00FF00,&HFFFFFF} _ } Dim result As Point = shw.ImageSearchScreen(pixAry,150,200,150,80) If result.X <> -1 Then MessageBox.Show("画像位置X:" & result.X.ToString & " Y:" & result.Y.ToString) Else MessageBox.Show("画像は見つかりませんでした") End If End Sub End Class
このページのQRコード
便利ウェブサイト
便利 Android アプリ
便利 iOS(iPhone,iPad) アプリ