在按钮的单击事件中添加以下代码:
- private void button1_Click(object sender, EventArgs e) {
- CalculatorControl calculator = new CalculatorControl(); CalDrop cal = new CalDrop(calculator);
- Point controlLoc = fm.PointToScreen(button1.Location);
- Point relativeLoc = new Point(controlLoc.X + button1.Width + 100, controlLoc.Y + button1.Height * 2);
- Rectangle calRect = button1.DisplayRectangle; cal.Show(locPoint);
- }
添加控件到DataGridViewCell
在你构建解决方案时,新的按钮控件会出现在工具箱中。添加以下代码到项目的窗体类中。










