在C#中给图片添加热区

来源:互联网 发布:ipadair2壁纸软件 编辑:程序博客网 时间:2024/04/29 00:12
 
System.Web.UI.WebControls.ImageMap   img   =   new   System.Web.UI.WebControls.ImageMap(); 
img.ImageUrl   
=   "PlanImg.aspx?PPID="   +   pp_id; 
DrawHotMap(
60,   95,   76,   476,   "1.aspx?pp_id="   +   pp_id,   "总计",   img); 
DrawHotMap(
110,   130,   76,   476,   "a.aspx?pp_id="   +   pp_id,   "合同",img); 
DrawHotMap(
130,   150,   76,   476,   "b.aspx?pp_id="   +   pp_id,   "入库",   img); 
DrawHotMap(
150,   170,   76,   476,   "c.aspx?pp_id="   +   pp_id,   "调拨",   img); 
DrawHotMap(
170,   190,   76,   476,   "d.aspx?pp_id="   +   pp_id,   "登记",   img); 
DrawHotMap(
5,   35,   550,   590,   "detail.aspx?pp_id="   +   pp_id,   "详细",   img); 
Panel1.Controls.Add(img); 
Panel1.Controls.Add(
new   LiteralControl(" <br> <br> ")); 


 

private   void   DrawHotMap(int   top,   int   bottom,   int   left,   int   right,   string   url,   string   strfont,ImageMap   img) 
        

                RectangleHotSpot   rect   
=   new   RectangleHotSpot(); 
                rect.Left   
=   left; 
                rect.Top   
=   top; 
                rect.Bottom   
=   bottom; 
                rect.Right   
=   right; 
                rect.AlternateText   
=   strfont; 
                rect.NavigateUrl   
=   url; 
                rect.Target   
=   "_blank"
                img.HotSpots.Add(rect); 
                img.Attributes.Add(
"hideFocus",   "true"); 
                img.HotSpotMode   
=   HotSpotMode.Navigate; 
        }
原创粉丝点击