如何给 StringGrid 添加类似 DBGrid的 OnCellClick 的事件?(50分)

  • 主题发起人 microwave
  • 开始时间
M

microwave

Unregistered / Unconfirmed
GUEST, unregistred user!
因为我的Cell中的值只有1,0,我希望可以通过单击某一Cell改变其中的值,像DBGrid中的 OnCellClick 事件?
 
StringGrid本身就有这种事件:OnSelectCell
 
你在 StringGrid1MouseDown 事件中,根据Row/Col改变你的值就行了
或者用 AdvStringGrid 构件
 
OnSelectCell
 
OnSelectCell
 
OnMouseDonw
记下Col Row, bDown := True;
OnMouseUp
对比ACol Col , ARow, Row
if bDown and (ACol = Col) and (ARow = Row) then
OnClick
 
我只是想学习一下如何给已有的控件添加事件
 
各位,OnMouseDown 和 OnMouseUp 事件中跟本没有 row 和 col 的值,只有 x,y 坐标,
用OnSelectCell事件也不行,只能在点第一下时有用,进入编辑状态就没用了.
 
不好意思,是我程序有误,可以了,放分
 
顶部