示例#1
0
 private Bitmap GetImage()
 {
     try
     {
         WindowFormAPI.SetForegroundWindow(curEasyConnect);
         Rect rect = new Rect();
         WindowFormAPI.GetWindowRect(this.imgCodeHandler, out rect);
         int    startX = rect.Left;
         int    startY = rect.Top;
         int    width  = rect.Right - rect.Left;
         int    height = rect.Bottom - rect.Top;
         Bitmap bitmap = GetPartOfImageRec(startX, startY, width, height);
         return(bitmap);
     }
     catch (Exception ex)
     {
         SetText(String.Format("\r\n获取验证码失败:{0}", ex.Message));
         return(null);
     }
 }