惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
P
Privacy International News Feed
T
Tenable Blog
L
Lohrmann on Cybersecurity
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Threat Research - Cisco Blogs
S
Securelist
C
CXSECURITY Database RSS Feed - CXSecurity.com
Cisco Talos Blog
Cisco Talos Blog
T
The Exploit Database - CXSecurity.com
S
Schneier on Security
P
Privacy & Cybersecurity Law Blog
Vercel News
Vercel News
Cyberwarzone
Cyberwarzone
月光博客
月光博客
T
The Blog of Author Tim Ferriss
Scott Helme
Scott Helme
爱范儿
爱范儿
Stack Overflow Blog
Stack Overflow Blog
C
Cisco Blogs
aimingoo的专栏
aimingoo的专栏
博客园 - 司徒正美
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
P
Proofpoint News Feed
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
L
LangChain Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
阮一峰的网络日志
阮一峰的网络日志
Simon Willison's Weblog
Simon Willison's Weblog
T
Tor Project blog
Security Latest
Security Latest
Blog — PlanetScale
Blog — PlanetScale
G
GRAHAM CLULEY
V
Vulnerabilities – Threatpost
博客园 - 三生石上(FineUI控件)
I
InfoQ
Spread Privacy
Spread Privacy
B
Blog RSS Feed
Microsoft Azure Blog
Microsoft Azure Blog
S
SegmentFault 最新的问题
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
MongoDB | Blog
MongoDB | Blog
C
CERT Recently Published Vulnerability Notes
A
About on SuperTechFans
博客园_首页
Engineering at Meta
Engineering at Meta
Project Zero
Project Zero
Latest news
Latest news

博客园 - 群

DataGridView调整列宽及using()的用法 COM 对象与其基础 RCW 分开后就不能再使用 终于解决了一个问题--如何在数据绑定时不让combox控件触发SelectedIndexChanged事件 如何在winform中子窗体提交数据后刷新父窗体中的DataGRIDVIEW数据? 关于在.net中 预览上传控件中路径的图片 的方法 在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL Server 的连接)[转] 获取新插入的数据的自增ID 漂浮窗体的实现 取得当前日期所在的星期里从星期一到星期日所有的日期列表 触发器不能读『转』 Server.MapPath介绍 Server.MapPath介绍 .NET里面取2个时间相差的天数 在static方法中调用非静态方法? label分页 使用回车代替Tab键的功能代码 绘图(包括绘坐标,图片) 很不错的传值 设置ComboBox默认
动态生成图片热点
· 2007-04-30 · via 博客园 - 群

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
    string strConn;
    string strSQL;
    SqlConnection sqlConn;                                   //定义
    RectangleHotSpot rhs = new RectangleHotSpot();
    PolygonHotSpot phs = new PolygonHotSpot();
    CircleHotSpot chs = new CircleHotSpot();
    HotSpot hs;
    protected void Page_Load(object sender, EventArgs e)
    {
        strConn = System.Configuration.ConfigurationManager.AppSettings["MapConnectionString"];//链接
        sqlConn = new SqlConnection(strConn);
        int intMapID = 1;
        if (Request["mapid"] != null)
        {
            intMapID = int.Parse(Request["mapid"].ToString());
        }
        strSQL = "SELECT * FROM tMap WHERE MMapID=@PMapID";
        SqlCommand sqlComm = new SqlCommand(strSQL, sqlConn);
        sqlComm.Parameters.Add(new SqlParameter("@PMapID", SqlDbType.Int));//获取传过来的值再动态绑定要显示的图片
        sqlComm.Parameters["@PMapID"].Value = intMapID;
        sqlComm.Connection.Open();
        SqlDataReader sqlDR = sqlComm.ExecuteReader();
        if (sqlDR.Read())
        {
            imap1.ImageUrl = sqlDR["MMapSRC"].ToString();
            sqlComm.Connection.Close();
             this.SubMap(intMapID);
        }
    }
    protected void SubMap(int intMapID1)                          //动态绑定热点
    {
        strSQL = "SELECT * FROM tArea WHERE MMapID=@PMapID";
        SqlCommand sqlComm = new SqlCommand(strSQL, sqlConn);
        sqlComm.Parameters.Add(new SqlParameter("@PMapID", SqlDbType.Int));
        sqlComm.Parameters["@PMapID"].Value = intMapID1;
        sqlComm.Connection.Open();
        SqlDataReader sqlDR = sqlComm.ExecuteReader();
        while (sqlDR.Read())
        {

            int intLinkType =int.Parse(sqlDR["MLinkType"].ToString());   //通过LinkType获取链接到的页面
            string strLink="";
            if (intLinkType == 0)
            {
                 strLink = "Default.aspx?mapid=" + sqlDR["MLinkMapID"];
            }
            else if (intLinkType == 1)
            {
                strLink = "Company.aspx?BID=" + int.Parse(sqlDR["MLinkBigGroup"].ToString()) + "&SID=" + int.Parse(sqlDR["MLinkSmallGroup"].ToString());
            }
            string strShape = sqlDR["MShape"].ToString();
            if (strShape == "poly")
            {
                phs.NavigateUrl = strLink;
                phs.Coordinates = sqlDR["MCoords"].ToString();
                hs = phs;
                imap1.HotSpots.Add(hs);
            }
            else if (strShape == "rect")
            {
                rhs.NavigateUrl = strLink;
                string strCoor = sqlDR["MCoords"].ToString();
                string[] strCoorArr = strCoor.Split(',');
                rhs.Top = int.Parse(strCoorArr[0]);
                rhs.Left = int.Parse(strCoorArr[1]);
                rhs.Right = int.Parse(strCoorArr[2]);
                rhs.Bottom = int.Parse(strCoorArr[3]);
                hs = rhs;
                imap1.HotSpots.Add(hs);
            }
            else if (strShape == "Circle")
            {
                chs.NavigateUrl = strLink;
                string strCoor = sqlDR["MCoords"].ToString();
                string[] strCoorArr = strCoor.Split(',');
                chs.Radius = int.Parse(strCoorArr[0]);
                chs.X = int.Parse(strCoorArr[1]);
                chs.Y = int.Parse(strCoorArr[2]);
                hs = chs;
                imap1.HotSpots.Add(hs);
            }
           
        }
        sqlComm.Connection.Close();
       
    }
}