回复 1楼menghuanyunxia的帖子
你可以通过PSShape的鼠标事件和ContextMenu来实现。
在鼠标事件里展示一个ContextMenu来显示ToolTip。
代码参考:
- FarPoint.Win.Spread.DrawingSpace.PSShape pso = new FarPoint.Win.Spread.DrawingSpace.RectangleShape();
- pso.CanFocus = true;
- pso.SetBounds(25, 25, 120, 120);
- this.fpSpread1.ActiveSheet.AddShape(pso);
- pso.MouseDown += pso_MouseDown;
复制代码
MouseDown的事件:
- void pso_MouseDown(object sender, MouseEventArgs e)
- {
- FarPoint.Win.Spread.DrawingSpace.PSShape pso = sender as FarPoint.Win.Spread.DrawingSpace.PSShape;
- if (e.Button == System.Windows.Forms.MouseButtons.Right)
- {
- ContextMenu cm = new ContextMenu();
- string content = "x:" + e.X + " y:" + e.Y.ToString()+" w:"+pso.Width+" h:"+pso.Height;
- MenuItem mi1 = new MenuItem(content);
- cm.MenuItems.Add(mi1);
- cm.Show(this.fpSpread1, new Point(e.X, e.Y));
- }
- }
复制代码 |