title: VB.Net Custom Bitmap
body: <p>Its a bit complicated and I will try my best to explain what I want to achieve.</p>
  <p>I've already worked a bit with bitmaps and copy from screen functions.
  This all worked very well. But these bitmaps are always rectangles and I would like to use my own bitmap if possible.</p>
  <p><strong>As an example:</strong></p>
  <p>Somewhere at position x, y on my screen is a map
  This map has several paths and junctions.
  There are also houses and things that don't interest me, I only focus on the paths in between.</p>
  <p>Now I want to scan this map for Argb Pixels using a bitmap and Copy from screen function. I have already done this and it works great, but instead of only scanning the paths for pixels, the whole map is scanned for pixels. But I only want these paths to be scanned.</p>
  <p>I have this map as a template and could make a screenshot of it. Can I now import this map into Photoshop, color the houses and everything that I don't need black and make the paths transparent and import them as bitmap so that the Copy From Screen function only scans the paths or is that even possible? I haven't found anything for vb.net if someone could lead me in a right direction I would be very thankful :)</p>
  <p>This is the code I got so far - simple pixelsearch function:</p>
  <pre class="lang-vb prettyprint-override"><code>Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
  
      Dim xd3 = Color.FromArgb(255, 100, 100, 100) 'Searching for this color on the screen
  
      Dim b As New Bitmap(2210, 1100)  'Position of Bitmap
      Dim g As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(b)
      g.CopyFromScreen(Me.Left, Me.Top, 0, 0, b.Size) 'Searching on Screen
  
      For i = 0 To (Me.Width - 0) 'searching each pixel
          For j = 0 To (Me.Height - 0) 'searching each pixel
              If b.GetPixel(i, j) = xd3 Then 'If pixel has same color that im searching for it will show a messagebox true
                  MessageBox.Show(&quot;true&quot;)
              End If
          Next
      Next
  
  End Sub
  </code></pre>