about uscontact

폼(Form) 내부를 클릭하여 이동시키는 방법

Author: zemna
Date: April 17, 2021
Share this:

WINAPI 변수 선언

public const int WM_NCLBUTTONDOWN = 0xA1;

public const int HT_CAPTION = 0x2;

Form의 MoveDown 이벤트 핸들러 작성

private void frmController_MouseDown(object sender, MouseEventArgs e)


    // 왼쪽버튼이 눌렸는지 확인

    if (e.Button == MouseButtons.Left)


        // 발생한 이벤트를 WM_NCLBUTTONDOWN 이벤트로 변경하여 전달하기

        this.Capture = false;

        Message message = Message.Create(Handle, WM_NCLBUTTONDOWN, (IntPtr)HT_CAPTION, IntPtr.Zero);

        WndProc(ref message);



Share this:

Leave a Reply

Your email address will not be published. Required fields are marked *


Professional software development agency estalished in Indonesia. We offers website setup, web application development, fulfillment service, and etc.
Follow us
Follow us to get latest news and tutorials.
2022 - Copyright, All Rights Reserved, Made by ZEMNA.NET with ❤️