av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

ASP.NET顯示漸變圖片

最終效果:

實(shí)現(xiàn)效果,首先準(zhǔn)備一張圖片,高度為25pixel,寬度為1至3pixel漸變的圖片??梢赃@里下載。

還要準(zhǔn)備數(shù)據(jù):

 
 
 
 
  1. Dictionary Datas  
  2.     {  
  3.         get 
  4.         {  
  5.             Dictionary d = new Dictionary();  
  6.             d.Add(1, 35);  
  7.             d.Add(2, 45);  
  8.             d.Add(3, 20);  
  9.             return d;  
  10.         }  
  11.     } 

ok,數(shù)據(jù)準(zhǔn)備完了,在aspx里放三個(gè)Label控件,當(dāng)然你可以顯示在其它控件或是標(biāo)簽中,有一點(diǎn)要注意的是Width="300",它是漸變圖片在100%的寬度:

 
 
 
 
  1.  
  2.           
  3.          

把數(shù)據(jù)顯示于Label上:

 
 
 
 
  1. protected void Page_Load(object sender, EventArgs e)  
  2.     {  
  3.         Data_Binding();  
  4.     }  
  5.  
  6.     private void Data_Binding()  
  7.     {  
  8.         int totals = 100;  
  9.         foreach (KeyValuePair kvp in Datas)  
  10.         {  
  11.             double rate = kvp.Value / (double)totals;  
  12.  
  13.             double width = rate * 300;  
  14.             switch (kvp.Key)  
  15.             {  
  16.                 case 1:  
  17.                     this.Label1.Text = GradientImage(width, rate);  
  18.                     break;  
  19.                 case 2:  
  20.                     this.Label2.Text = GradientImage(width, rate);  
  21.                     break;  
  22.                 case 3:  
  23.                     this.Label3.Text = GradientImage(width, rate);  
  24.                     break;  
  25.             }  
  26.         }  
  27.     }  
  28.  
  29.     private string GradientImage(double width, double rate)  
  30.     {  
  31.         return " " + rate.ToString("p");  
  32.     } 

分享文章:ASP.NET顯示漸變圖片
文章源于:http://uogjgqi.cn/article/cdidjeo.html
掃二維碼與項(xiàng)目經(jīng)理溝通

我們?cè)谖⑿派?4小時(shí)期待你的聲音

解答本文疑問(wèn)/技術(shù)咨詢/運(yùn)營(yíng)咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流