如何选择字符串网格的多个单独单元格?
我正在寻找一个字符串网格,它允许我在网格中的任何位置选择多个单元格,而无需它们彼此相邻,例如按 CTRL 并单击网格上的各个单元格。或者如果有人知道如何使用标准 Delphi TStringGrid 来做到这一点。
任何指点将不胜感激。
I am looking for a string grid that allows me select multiple cells anywhere in the grid without them adjoining each other, e.g pressing CTRL and clicking on various cells over the grid. Or if anyone knows how to do this with the standard Delphi TStringGrid.
Any pointer would be gratefully received.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然这里有很多有能力的人,但既然你还没有得到任何答案,我想我还是试试吧。
我不知道有什么方法可以让该组件为您执行此操作。但是,当您按住 Control 键并单击某个单元格时,将调用 OnSelectedCell 事件。 (我刚刚测试过。)您可以将代码放入事件处理程序中,将单元格的行和列添加到您保留的所选行和列的列表中。然后,在 OnDrawCell 事件中,突出显示该单元格:
Although there are a lot of better capable people here, since you haven't gotten any answers, I thought I'd give it a try.
I'm not aware of a way to have the component do this for you. However, when you Control-click a cell, the event OnSelectedCell is called. (I just tested that.) You could put code in an event handler that adds the cell's row and column to a list that you keep of the rows and columns that are selected. Then, in the OnDrawCell event, highlight the cell: