您的位置:首页 > 编程语言 > C#

c#如何实现无标题栏窗口程序的移动?

2007-11-19 17:12 411 查看

using System;


using System.Collections.Generic;


using System.ComponentModel;


using System.Data;


using System.Drawing;


using System.Text;


using System.Windows.Forms;


using System.Runtime.InteropServices;


namespace CallBuilder




...{


public partial class Iformest : Form




...{




[DllImport("User32.dll", EntryPoint = "SendMessage")]


private static extern int SendMessage(int hWnd, int Msg, int wParam, int lParam);


[DllImport("User32.dll", EntryPoint = "ReleaseCapture")]


private static extern int ReleaseCapture();










public Iformest(Form newform)




...{


InitializeComponent();










this.myForm.MyFormMouseDown += new MouseEventHandler(myForm_MyFormMouseDow
n);












}






void myForm_MyFormMouseDown(object sender, MouseEventArgs e)




...{






if (e.Button == MouseButtons.Left)




...{


ReleaseCapture();


SendMessage(this.Handle.ToInt32(), 0x0112, 0xF012, 0);


}




}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: