asp网站建设 文献,商务网站建设,公司网站建设要注意什么,青岛网站建设市场分析因为客户要求程序要在浏览器上运行#xff0c;但是这些信息#xff08;这个程序只在政府某部门内部使用#xff09;并不需要公开#xff0c;所以我们选择使用Windows应用程序#xff0c;并将该程序嵌入到网页中。。。。 就我个人做的这部分简单的说下#xff0c;我负… 因为客户要求程序要在浏览器上运行但是这些信息这个程序只在政府某部门内部使用并不需要公开所以我们选择使用Windows应用程序并将该程序嵌入到网页中。。。。 就我个人做的这部分简单的说下我负责的是在地图上画标注“标注”在这里指的是小图标,以后都使用这个定义对应于不同的情况需要画出不同的标注对于该标注需要有拖拽功能并且需要将最后的位置记录下来以便下次载入时会显示在上次修改的位置修改该图标对应的信息删除该标注查看该标注的当前信息以及历史信息等。这里先介绍下控件的拖拽其原理就是让控件的位置随鼠标一起移动鼠标移动多少像素那么控件就移动多少那么接下来事情就很简单了。为了以后方便复用我封装了一个类拖拽控件直接调用这个类就成了 调用的代码如下 using System;using System.Collections.Generic;using System.ComponentModel;using System.Drawing;using System.Data;using System.Text;using System.Windows.Forms;namespace WinControlLib{ public partial class UserControl4 : UserControl { public UserControl4() { InitializeComponent(); DragControlClass objnew DragControlClass(button1); } }} 核心部分是下面这个类 using System;using System.Collections.Generic;using System.Text;using System.Windows.Forms;namespace WinControlLib{ public class DragControlClass { //待拖动的控件 private Control m_Control; //鼠标按下时的xy坐标 private int m_X; private int m_Y; public DragControlClass(Control control) { m_Control control; m_Control.MouseDown new MouseEventHandler(control_MouseDown); m_Control.MouseMove new MouseEventHandler(contro_MouseMove); } private void control_MouseDown(object sender, MouseEventArgs e) { m_X e.X; m_Y e.Y; } private void contro_MouseMove(object sender, MouseEventArgs e) { if (e.Button MouseButtons.Left) { int x e.X - m_X; int y e.Y - m_Y; this.m_Control.Left x; this.m_Control.Top y; } } }} 虽然这个类代码不多却可以节省我们很多的时间减少很多的重复工作量这个类可以拖拽继承自System.Windows.Form.Control的控件 先说到这里希望对大家有用。 转载于:https://www.cnblogs.com/pkurain/archive/2008/06/06/1215005.html