'赤赤赤赤 '青青白白 '緑緑緑白 Dim pixAry As Integer(,) = New Integer(,) { _ {&H0000FF,&H0000FF,&H0000FF,&H0000FF} _ , {&HFF0000,&HFF0000,&HFFFFFF,&HFFFFFF} _ , {&H00FF00,&H00FF00,&H00FF00,&HFFFFFF} _ }
'オブジェクトウインドウ内を検索して、色を示す2次元配列とマッチした全てのスクリーン座標値をPoint構造体の配列で返します Dim instance As ClientHwnd Dim pixAry As Integer(,) Dim returnValue As System.Drawing.Point() 'Overloads returnValue = instance.ImageAllSearch(pixAry)
'オブジェクトウインドウ内の指定した四方の幅を除く範囲を検索して '色を示す2次元配列とマッチした全てのスクリーン座標値をPoint構造体の配列で返します Dim instance As ClientHwnd Dim pixAry As Integer(,) Dim ofsLeft As Integer Dim ofsTop As Integer Dim ofsRight As Integer Dim ofsBottom As Integer Dim returnValue As System.Drawing.Point() 'Overloads returnValue = instance.ImageAllSearch(pixAry, ofsLeft, ofsTop, ofsRight, ofsBottom)
'ClientHwndクラス ImageAllSearchメソッド Imports System.Windows.Forms Imports System.Drawing Public Class AddIn Private chw As ClientHwnd Public Sub New() chw = New ClientHwnd() 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() = chw.ImageAllSearch(pixAry) Dim msg As String = "" For Each p As Point In result msg &= "X:" & p.X.ToString & "Y:" & p.Y.ToString & "," Next MessageBox.Show("画像が見つかった位置:" & msg) End Sub End Class
'ClientHwndクラス ImageAllSearchメソッド Imports System.Windows.Forms Imports System.Drawing Public Class AddIn Private chw As ClientHwnd Public Sub New() chw = New ClientHwnd() 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() = chw.ImageAllSearch(pixAry,150,200,150,80) Dim msg As String = "" For Each p As Point In result msg &= "X:" & p.X.ToString & "Y:" & p.Y.ToString & "," Next MessageBox.Show("画像が見つかった位置:" & msg) End Sub End Class
このページのQRコード
便利ウェブサイト
便利 Android アプリ
便利 iOS(iPhone,iPad) アプリ