delphi, 怎样让dbgrideh只剩下已选行?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了delphi, 怎样让dbgrideh只剩下已选行?相关的知识,希望对你有一定的参考价值。

参考技术A 选中某行后,用数据集的Filter把其他的记录过滤掉就行了 参考技术B delphi, 怎样让dbgrideh只剩下已选行?
toBookmark(pointer(GrdVoucherStocks.SelectedRows.Items[i]));
CDSVoucherStocks.Edit;

绿竹别其三分景 红梅正报万家春 春回大地 本回答被提问者采纳

delphi DBGridEh 问题

DBGridEh的OnGetCellParams事件中
if qymst.FieldByName('spunit').AsString = 'm' then
begin
dbgrideh1.FieldColumns['pcs'].Font.Color := clred;
end
else
dbgrideh1.FieldColumns['pcs'].Font.Color := clnone;为什么当spunit <> m 的时候怎个网格都在闪

OnGetCellParams事件是会一直运行的(相当于刷新),如果你这里要当qymst.FieldByName(\'spunit\').AsString = \'m\'时才改变字体的颜色为红色,那么你完成可以设置所有字体的颜色为clnone,然后将事件改为:
if qymst.FieldByName(\'spunit\').AsString = \'m\' then
begin
dbgrideh1.FieldColumns[\'pcs\'].Font.Color := clred;
end;
这样就好了。
参考技术A 因为一直在重复赋值。当spunit <> m 的时候,字段pcs的字体颜色为空。但是你代码不该放在getcellparams事件中,建议放在DataSource的 dataChange事件中。

以上是关于delphi, 怎样让dbgrideh只剩下已选行?的主要内容,如果未能解决你的问题,请参考以下文章