2010-05-03 25 views
0

我在Windows應用程序中有一個代碼,現在我試圖在web 應用程序中實現,但showimg顯示它沒有光標類 (System .Windows.Forms.Cursor)so..wat在Web應用程序中是等效的。等效於Web應用程序中的System.Windows.Forms.Cursor(Asp.Net)

Here is my code 

     private void btnGo_Click(System.Object sender, System.EventArgs e) 
    { 
     this.Cursor = Cursors.WaitCursor; 
     Application.DoEvents(); 


     // Load the images. 
     Bitmap bm1 = (Bitmap) (Image.FromFile(txtFile1.Text)); 
     Bitmap bm2 = (Bitmap) (Image.FromFile(txtFile2.Text)); 

     // Make a difference image. 
     int wid = Math.Min(bm1.Width, bm2.Width); 
     int hgt = Math.Min(bm1.Height, bm2.Height); 
     Bitmap bm3 = new Bitmap(wid, hgt); 

     // Create the difference image. 
     bool are_identical = true; 
     int r1; 
     int g1; 
     int b1; 
     int r2; 
     int g2; 
     int b2; 
     int r3; 
     int g3; 
     int b3; 
     Color eq_color = Color.White; 
     Color ne_color = Color.Transparent; 
     for (int x = 0; x <= wid - 1; x++) 
     { 
      for (int y = 0; y <= hgt - 1; y++) 
      { 
       if (bm1.GetPixel(x, y).Equals(bm2.GetPixel(x, y))) 
       { 
        bm3.SetPixel(x, y, eq_color); 


       } 
       else 
       { 
        bm1.SetPixel(x, y, ne_color); 
        are_identical = false; 
       } 
      } 
     } 

     // Display the result. 
     picResult.Image = bm1; 

     Bitmap Logo = new Bitmap(picResult.Image); 
     Logo.MakeTransparent(Logo.GetPixel(1, 1)); 
     picResult.Image = (Image)Logo; 

     this.Cursor = Cursors.Default; 
     if ((bm1.Width != bm2.Width) || (bm1.Height != bm2.Height)) 
     { 
      are_identical = false; 
     } 
     if (are_identical) 
     { 
      MessageBox.Show("The images are identical"); 
     } 
     else 
     { 
      MessageBox.Show("The images are different"); 
     } 

     //bm1.Dispose() 
     // bm2.Dispose() 
    } 

回答

0

在ASP.NET中,您不能訪問遊標,因爲它運行在服務器端..您可以從代碼中刪除。

另外Application.DoEvents();和MessageBox.Show()不適用於Web環境。