コード例 #1
0
ファイル: GameHandle.cs プロジェクト: DNoki/NokiKanColle
 /// <summary>
 /// 获取游戏窗口图像(*注意析构图像)
 /// </summary>
 /// <returns>游戏图像</returns>
 public Bitmap GetGameBitmap()
 {
     if (!IsSuccess)
     {
         return(null);
     }
     if (_photo != null)
     {
         _photo?.Dispose(); _photo = null;
     }
     if (_mode == FunctionHandle.MODE.Handle)
     {
         _photo = FunctionBitmap.PrtGameWindow(this);
     }
     else if (_mode == FunctionHandle.MODE.Desktop)
     {
         _photo = FunctionBitmap.CutImage(FunctionBitmap.CopyWindow(), _xy.X, _xy.Y, 800, 480, true);
     }
     else if (_mode == FunctionHandle.MODE.Chorme)
     {
         _photo = FunctionBitmap.CutImage(FunctionBitmap.PrtGameWindow(this), _xy.X, _xy.Y, 800, 480, true);
     }
     else
     {
         return(null);
     }
     return(_photo);
 }
コード例 #2
0
 /// <summary>
 /// 点击树状图上的某一节点,刷新图像
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void GameWindow_treeView_Click(object sender, EventArgs e)
 {
     if (GameWindow_HandleList_treeView.SelectedNode != null)
     {
         // 将当前节点文本添加到文本框
         this.GameWindow_InputIntPtr_textBox.Text = GameWindow_HandleList_treeView.SelectedNode.Text;
         if (GameWindow_GamePicture_pictureBox.Image != null)
         {
             Image i = GameWindow_GamePicture_pictureBox.Image;
             GameWindow_GamePicture_pictureBox.Image = null;
             i.Dispose();
         }
         try
         {
             GameWindow_GamePicture_pictureBox.Image = FunctionBitmap.ResizeImage(FunctionBitmap.PrtGameWindow(Function.Functions.StrToIntPtr(GameWindow_HandleList_treeView.SelectedNode.Text)), 200, 120, true);
         }
         catch (Exception)
         {
             /***************
             *  在这里加入失败图像
             ***************/
         }
     }
 }