拖动窗体MOUSEUP怎么写,用什么方法?
解决方案 »
- ThreadStart 的作用 下面的两个开启线程方式有什么区别?
- c1FlexGrid控件单元格多选问题
- abnormal program termination,高手请帮忙啊
- 如何让webbrowser显示数据库里面的图片
- ########## 概念问题,100分相送:我是新手,请问在C#里怎么构架CS结构,WinForm下的三层结构?????
- 关于数据库定时备份功能~!~!!~!大家参与 给出出 办法
- C#代码规范
- 在线等为何我照帮助写的正则表达式不对呀。
- C#写的程序本机可以运行,客户机不行,主界面直接卡死
- 请问C#是否支持控件数组,具体如何应用?
- 学习c#选择什么书比较好?
- 不装vs2005但装.net framework 2.0和sdk能做asp.net c#吗?
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;using System.Reflection;
using System.Runtime.InteropServices;
namespace WindowsApplication4
{
public partial class Form1 : Form
{ [DllImportAttribute("user32.dll")]
public static extern bool ReleaseCapture();
[DllImportAttribute("user32.dll")]
public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam); public const int WM_SYSCOMMAND = 0x0112;
public const int SC_MOVE = 0xF010;
public const int HTCAPTION = 0x0002; public Form1()
{
InitializeComponent();
} private void Form1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
ReleaseCapture();
SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
}
}
}
}
// 功能:让日历可移动
// 编码:Dragon Deng
var IsMove = false;
var dragClickX = 0;
var dragClickY = 0;function catchCalendar(e){
IsMove = true;
dragClickX=event.clientX-parseInt(document.getElementById("calendar").style.left);
dragClickY=event.clientY-parseInt(document.getElementById("calendar").style.top);
document.getElementById("calendar").setCapture();
document.onmousemove = moveCalendar;
}function releaseCalendar(e){
IsMove = false;
document.getElementById("calendar").releaseCapture();
document.onmousemove = null;
hideElement( 'SELECT', document.getElementById("calendar") );
hideElement( 'APPLET', document.getElementById("calendar") );
}function moveCalendar(e){
if(IsMove){
document.getElementById("calendar").style.left =event.clientX-dragClickX;
document.getElementById("calendar").style.top = event.clientY-dragClickY;
document.getElementById("calendar").style.visible = 'show'
}
}
//
//******************************************* end ***********************************************************//