• 大小: 2.57MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-03
  • 语言: C#
  • 标签: C#  winform  

资源简介

鼠标点击左键,画多边形。画完一个多边形之后,双击窗体,然后开始画第二个多边形

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace mapManage
{
    public partial class areaImgList : Form
    {
        int pageSize = 0;     //每页显示行数
        int nMax = 0;         //总记录数
        int pageCount = 0;    //页数=总记录数/每页显示行数
        int pageCurrent = 0;   //当前页号
        int nCurrent = 0;      //当前记录行
        DataSet ds = new DataSet();
        DataTable dtInfo = new DataTable();
        string strWhere = string.Empty;//查询条件
        public static string areaId = string.Empty;//记录一个热区的区域id

        public areaImgList()
        {
            InitializeComponent();
        }

        private void areaImgList_Load(object sender EventArgs e)
        {
            ds=new areaImageDal().GetList(““);
            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                comboBox1.DataSource = ds.Tables[0];
                comboBox1.DisplayMember = “name“;
                comboBox1.ValueMember = “id“;
                comboBox1.Text = “--请选择--“;

                strWhere = “ areaId=“ + comboBox1.SelectedValue.ToString();
            }

            dtInfo = new areaPointDal().GetListView(strWhere).Tables[0];
            InitDataSet();
        }

        private void InitDataSet()
        {
            pageSize = 20;      //设置页面行数
            nMax = dtInfo.Rows.Count;

            pageCount = (nMax / pageSize);    //计算出总页数

            if ((nMax % pageSize) > 0)
            { 
                pageCount++;
            }

            pageCurrent = 1;    //当前页数从1开始
            nCurrent = 0;       //当前记录数从0开始

            LoadData();
        }

        private void LoadData()
        {
            int nStartPos = 0;   //当前页面开始记录行
            int nEndPos = 0;     //当前页面结束记录行

            DataTable dtTemp = dtInfo.Clone();   //克隆DataTable结构框架

            if (pageCurrent == pageCount)
            {
                nEndPos = nMax;
            }
            else
            {
                nEndPos = pageSize * pageCurrent;
            }

            nStartPos = nCurrent;

            lblPageCount.Text = pageCount.ToString();
            txtCurrentPage.Text = Convert.ToString(pageCurrent);

            //从元数据源复制记录行
            for (int i = nStartPos; i < nEndPos; i++)
            {
                dtTemp.ImportRow(dtInfo.Rows[i]);
                nCurrent++;
            }
            bdsInfo.DataSource = dtTemp;
            bdnInfo.BindingSource = bdsInfo;
            dgvInfo.DataSource = bdsInfo;
        }

        private void bdnInfo_ItemClicked(object sender ToolStripItemClickedEventArgs e)
        {
            if (e.ClickedItem.Text == “关闭“)
            {
                this.Close();
            }
            if (e.ClickedItem.Text == “上一页“)
            {
                pageCurrent--;

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       4981  2011-08-24 16:29  demo\mapManage\mapManage\areaImgList.cs

     文件      22232  2011-08-24 16:29  demo\mapManage\mapManage\areaImgList.Designer.cs

     文件      13041  2011-08-24 16:29  demo\mapManage\mapManage\areaImgList.resx

     文件      91648  2011-08-29 11:59  demo\mapManage\mapManage\bin\Debug\mapManage.exe

     文件      85504  2011-08-29 11:59  demo\mapManage\mapManage\bin\Debug\mapManage.pdb

     文件      14328  2011-08-29 11:47  demo\mapManage\mapManage\bin\Debug\mapManage.vshost.exe

     文件       1200  2011-08-22 14:10  demo\mapManage\mapManage\class\areaImage.cs

     文件       7010  2011-08-22 14:20  demo\mapManage\mapManage\class\areaImageDal.cs

     文件       1107  2011-08-22 14:14  demo\mapManage\mapManage\class\areaPoint.cs

     文件       7454  2011-08-24 14:58  demo\mapManage\mapManage\class\areaPointDal.cs

     文件       2147  2011-08-22 13:43  demo\mapManage\mapManage\class\SqlHelper.cs

     文件       3972  2011-08-29 11:58  demo\mapManage\mapManage\editHotArea.cs

     文件       7131  2011-08-29 11:58  demo\mapManage\mapManage\editHotArea.Designer.cs

     文件       5814  2011-08-29 11:58  demo\mapManage\mapManage\editHotArea.resx

     文件       5214  2011-08-29 11:46  demo\mapManage\mapManage\editHotPoint.cs

     文件       6503  2011-08-29 11:45  demo\mapManage\mapManage\editHotPoint.Designer.cs

     文件       5814  2011-08-29 11:45  demo\mapManage\mapManage\editHotPoint.resx

     文件       3953  2011-08-24 15:13  demo\mapManage\mapManage\imgList.cs

     文件      25307  2011-08-24 15:13  demo\mapManage\mapManage\imgList.Designer.cs

     文件      11216  2011-08-24 15:13  demo\mapManage\mapManage\imgList.resx

     文件       5482  2011-08-29 11:08  demo\mapManage\mapManage\mapManage.csproj

     文件       4193  2011-08-29 11:59  demo\mapManage\mapManage\obj\Debug\mapManage.areaImgList.resources

     文件        791  2011-08-29 11:59  demo\mapManage\mapManage\obj\Debug\mapManage.csproj.FileListAbsolute.txt

     文件       1141  2011-08-29 11:59  demo\mapManage\mapManage\obj\Debug\mapManage.csproj.GenerateResource.Cache

     文件        180  2011-08-29 11:59  demo\mapManage\mapManage\obj\Debug\mapManage.editHotArea.resources

     文件        180  2011-08-29 11:59  demo\mapManage\mapManage\obj\Debug\mapManage.editHotPoint.resources

     文件      91648  2011-08-29 11:59  demo\mapManage\mapManage\obj\Debug\mapManage.exe

     文件       4193  2011-08-29 11:59  demo\mapManage\mapManage\obj\Debug\mapManage.imgList.resources

     文件      85504  2011-08-29 11:59  demo\mapManage\mapManage\obj\Debug\mapManage.pdb

     文件      34984  2011-08-29 11:59  demo\mapManage\mapManage\obj\Debug\mapManage.Properties.Resources.resources

............此处省略35个文件信息

评论

共有 条评论