private void OnMouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { QuantitySettingForm f2 = new QuantitySettingForm(stocknum); DialogResult res = f2.ShowDialog(); if (res == DialogResult.Cancel) { stocknum = f2.m_DefaultNum; return; } } }
public const int WN_NCRBUTTONDOWN = 0x00A4; /* 右键单击 */ protected override void WndProc(ref Message m) { if (m.Msg == WM_NCLBUTTONDOWN) { txb_stockcode.Focus(); } if (m.Msg == WN_NCLBUTTONDBLCLK) { this.TopMost = !this.TopMost; } if (m.Msg == WN_NCRBUTTONDOWN) { m.WParam = IntPtr.Zero; QuantitySettingForm f2 = new QuantitySettingForm(stocknum); DialogResult res = f2.ShowDialog(); if (res == DialogResult.Cancel) { stocknum = f2.m_DefaultNum; } return; } base.WndProc(ref m); }