【程序编程相关:等待pear投票的模板程序HTML_Te】
【推荐阅读:apache2的中文手册】
如上3图所示,右键菜单里的选项随着鼠标指向的单元格数据不同而不同.如何实现呢?问题的关键在于如何取得鼠标指向的单元格的值. 查bcb帮助,看到dbgrid中有一方法: tcustomgrid::mousecoord tcustomgrid see also ———————————————————————— returns the row and column indexes of the cell that contains a point specified in screen coordinates. struct tgridcoord { int x; int y; }; tgridcoord __fastcall mousecoord(int x, int y); description call mousecoord to locate the column and row of the cell which contains a given screen coordinate. usually, mousecoord is used to locate the cell that is under the mouse. 最后一句的大致意思是可以通过调用dbgrid的mousecoord方法来取得单元格的行与列,但必须要知道单元格在屏幕中的坐标.通常地,mousecoord事件被用取得鼠标指向的单元格的行与列. 只要知道了单元格的行与列就可以通过dbgrid->columns->items[]来取得单元格所属的字段的名称,而又可利用字段名来确定单元格中的值:query->fieldbyname(fieldname)->asstring.如何取得单元格在屏幕中的坐标?指向单元格的鼠标坐标就是需要的坐标.如何取得鼠标的坐标?利用dbgrid中的mousemove事件,它将会传递出鼠标的坐标.... 下一页