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

推荐订阅源

N
News and Events Feed by Topic
WordPress大学
WordPress大学
Vercel News
Vercel News
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
小众软件
小众软件
L
LangChain Blog
雷峰网
雷峰网
D
DataBreaches.Net
博客园 - 三生石上(FineUI控件)
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
Tor Project blog
NISL@THU
NISL@THU
Scott Helme
Scott Helme
量子位
S
Security Affairs
T
Threat Research - Cisco Blogs
博客园_首页
云风的 BLOG
云风的 BLOG
D
Docker
AWS News Blog
AWS News Blog
腾讯CDC
博客园 - 聂微东
The GitHub Blog
The GitHub Blog
U
Unit 42
Recent Announcements
Recent Announcements
Apple Machine Learning Research
Apple Machine Learning Research
G
Google Developers Blog
T
The Exploit Database - CXSecurity.com
MongoDB | Blog
MongoDB | Blog
Stack Overflow Blog
Stack Overflow Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
L
LINUX DO - 热门话题
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
The Last Watchdog
The Last Watchdog
C
Cybersecurity and Infrastructure Security Agency CISA
IT之家
IT之家
W
WeLiveSecurity
P
Privacy & Cybersecurity Law Blog
F
Full Disclosure
L
Lohrmann on Cybersecurity
The Hacker News
The Hacker News
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Y
Y Combinator Blog
S
Security @ Cisco Blogs
C
Cyber Attacks, Cyber Crime and Cyber Security
C
Check Point Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
N
News and Events Feed by Topic
PCI Perspectives
PCI Perspectives
I
InfoQ

博客园 - 群

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();
       
    }
}