![](/img/trans.png)
[英]How to use Delphi Inc() and Dec() procedures in C++ Builder
[英]How to use Delphi “in” operator in C++ Builder
我是新手程序員。 我需要使用Delphi的in
運營商在C ++ Builder的XE是這樣的:
if (dgColLines in DBGrid->Options)
// include vertical lines in total (one per column)
TotalColumnWidth = TotalColumnWidth + ColumnCount;
if (dgColLines **in** DBGrid->Options)
如何在C ++ Builder中做到這一點?
提前致謝。
使用Contains
方法檢查集合是否包含特定元素:
if( DBGrid->Options.Contains(dgColLines) )
TotalColumnWidth = TotalColumnWidth + ColumnCount;
查看有問題的屬性TDBGrid.Options
,其類型為TDBGridOptions
,定義為:
typedef System::Set<TDBGridOption, TDBGridOption::dgEditing,
TDBGridOption::dgTitleHotTrack> TDBGridOptions;
如您所見,C ++ Builder使用模板System::Set<T, minEl, maxEl>
來模擬Delphi集類型。
使用內置的Delphi集合運算符提供的所有功能都通過Set
的方法公開。 具體到這個問題,設置成員資格正在使用Contains()
進行測試。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.