using System; using System.Runtime.InteropServices; using System.Windows.Forms; namespace Casic.Birmm.RbFreqStandMeasure.home { public partial class SetDevChannelDlg : Form { #region 无边框拖动效果/最小化窗口/关闭窗口 [DllImport("user32.dll")]//拖动无窗体的控件 public static extern bool ReleaseCapture(); [DllImport("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; private void panel1_MouseDown(object sender, MouseEventArgs e) { //拖动窗体 ReleaseCapture(); SendMessage(Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0); } #endregion public Action HideMaskAction { get; set; } public SetDevChannelDlg(int channelNo) { InitializeComponent(); textBox_channelNo.Text = channelNo.ToString(); } private void btnExitChannel_Click(object sender, EventArgs e) { this.HideMaskAction(); } private void checkBox_stability_CheckedChanged(object sender, EventArgs e) { if (checkBox_stability.Checked) { groupBox3.Enabled = true; } else { groupBox3.Enabled = false; } } private void btnSave_Click(object sender, EventArgs e) { this.HideMaskAction(); } } }