1
아래 코드를 사용하여 윈도우의 폼을 이동하고 작업을 올바르게 옮기면 문제는 불투명하고 가까이 있습니다. 저는이 방법으로 작업하고 싶습니다 : 버튼 불투명도 = 0.5, 버튼 불투명도 = 1, 왼쪽 버튼이 눌려져있을 때 마우스 윈도우 이동을 움직일 때 폼을 클릭했을 때 폼을 닫아야 만합니다.윈도우 이동 문제
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
public partial class FormImage : Form {
public const int WM_NCLBUTTONDOWN = 0xA1;
public const int HT_CAPTION = 0x2;
[DllImportAttribute("user32.dll")]
public static extern int SendMessage(IntPtr hWnd,
int Msg, int wParam, int lParam);
[DllImportAttribute("user32.dll")]
public static extern bool ReleaseCapture();
public FormImage() {
InitializeComponent();
}
private void FormZdjecie_MouseMove(object sender, MouseEventArgs e) {
if (e.Button == MouseButtons.Left) {
ReleaseCapture();
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 6);
}
}
private void FormImage_MouseDown(object sender, MouseEventArgs e) {
this.Opacity = 0.5;
}
private void FormImage_MouseUp(object sender, MouseEventArgs e) {
this.Opacity = 1;
}
private void FormImage_MouseClick(object sender, MouseEventArgs e) {
Close();
}
}
이 코드를 어떻게 수정합니까?