首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

wuyazhe 进来一下,有个有关问题

2013-11-23 
wuyazhe 进来一下,有个问题你的代码用VB.NET怎么写,谢谢[System.Runtime.InteropServices.DllImport(user

wuyazhe 进来一下,有个问题
你的代码用VB.NET怎么写,谢谢
[System.Runtime.InteropServices.DllImport("user32.dll")]   
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wparam, int lparam);   
protected override void OnMouseDown(MouseEventArgs e)   
{   
    base.OnMouseDown(e);   
    if (e.Button == MouseButtons.Left)//按下的是鼠标左键   
    {   
        Capture = false;//释放鼠标,使能够手动操作   
        SendMessage(this.Handle, 0x00A1, 2, 0);//拖动窗体   
    }   



[解决办法]

Public Class Form1
    Declare Function SendMessageW Lib "user32" (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
    Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
        MyBase.OnMouseDown(e)
        If e.Button = MouseButtons.Left Then
            Capture = False
            SendMessageW(Me.Handle, &HA1, 2, 0)
        End If
    End Sub
End Class

热点排行