예제 #1
0
 // On "Ok" button
 private void okButton_Click(object sender, System.EventArgs e)
 {
     device = filters[deviceCombo.SelectedIndex].MonikerString;
     MainForm f = new MainForm();
     f.CreateCelT.Enabled = true;
     f.Dispose();
 }
예제 #2
0
 private Point StartControl(int x, int y)
 {
     MainForm f = new MainForm();
     Bitmap image = new Bitmap(f.pictureBox1.BackgroundImage);
     Utility.UnsafeBitmap uBitmap = new Utility.UnsafeBitmap(image);
     image.Save("D:\\saveImage.bmp");
     uBitmap.LockBitmap();
     Point pStart = new Point(-1, -1);
     for (int Y = y; Y < y + 30; Y++)
     {
         if (y >= 480)
             break;
         for (int X = x; X < x + 30; X++)
         {
             if (X >= 640)
                 break;
             int r = uBitmap.GetPixel(X, Y).red;
             int b = uBitmap.GetPixel(X, Y).blue;
             int g = uBitmap.GetPixel(X, Y).green;
             if ((r - 80 > g) && (r - 80 > b))
             {
                 if (pStart.X == -1) // save start point
                 {
                     pStart.X = X;
                     pStart.Y = Y;
                     break;
                 }
             } //if ((r - 100 > g) && (r - 100 > b))
         } //for (int x = 0; x < uBitmap.Bitmap.Width; x++)
         if (pStart.X != -1)
         {
             break;
         }
     }
     uBitmap.UnlockBitmap();
     uBitmap.Dispose();
     image.Dispose();
     //pWEnd = GorizontalControl(pStart, image);
     //pHEnd = VerticalControl(pStart, image);
     return pStart;
 }
예제 #3
0
 private Point VerticalControl(Point pStart)
 {
     MainForm f = new MainForm();
     Bitmap image = new Bitmap(f.pictureBox1.BackgroundImage);
     Utility.UnsafeBitmap uBitmap = new Utility.UnsafeBitmap(image);
     uBitmap.LockBitmap();
     Point pEnd = new Point(-1, -1);
     for (int y = pStart.Y; y < 30 + pStart.Y; y++)
     {
         int r = uBitmap.GetPixel(pStart.X, y).red;
         int b = uBitmap.GetPixel(pStart.X, y).blue;
         int g = uBitmap.GetPixel(pStart.X, y).green;
         if (((r - 80 > b) && (r - 80 > g)) || ((r > 150) && (g > 120) && (b > 120)))
         {
         }
         else
         {
             pEnd.X = pStart.X;
             pEnd.Y = y;
             break;
         }
     }
     uBitmap.UnlockBitmap();
     uBitmap.Dispose();
     image.Dispose();
     return pEnd;
 }
예제 #4
0
 private Point GorizontalControl(Point pStart)
 {
     Point pHEnd = new Point(-1, -1);
     MainForm f = new MainForm();
     Bitmap image = new Bitmap(f.pictureBox1.BackgroundImage);
     Utility.UnsafeBitmap uBitmap = new Utility.UnsafeBitmap(image);
     uBitmap.LockBitmap();
     for (int x = pStart.X; x < 30 + pStart.X; x++)
     {
         int r = uBitmap.GetPixel(x, pStart.Y).red;
         int b = uBitmap.GetPixel(x, pStart.Y).blue;
         int g = uBitmap.GetPixel(x, pStart.Y).green;
         if (((r - 80 > b) && (r - 80 > g)) || ((r > 150) && (g > 120) && (b > 120)))
         {
         }
         else
         {
             pHEnd.X = x;
             pHEnd.Y = pStart.Y;
             break;
         }
     }
     uBitmap.UnlockBitmap();
     uBitmap.Dispose();
     image.Dispose();
     return pHEnd;
 }