Multiline rows in Virtual mode |
Post Reply |
Author | |
stiff upper lip
Newbie Joined: 17 June 2006 Location: Russian Federation Status: Offline Points: 3 |
Post Options
Thanks(0)
Posted: 17 June 2006 at 10:02am |
hi
How I can use different height for different rows in virtual mode , I use extreme report control in virtual mode to read data from access data base , I tried to do the same as report control sample , means , to create a new class CReportMultilinePaintManager , and override the
CReportMultilinePaintManager::GetRowHeight( ....) function , but it wont work:( , , can you help me to get over this problem |
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
stiff upper lip
Newbie Joined: 17 June 2006 Location: Russian Federation Status: Offline Points: 3 |
Post Options
Thanks(0)
|
I wanted to use the same CReportMultilinePaintManager class used in the reportcontrol sample , here is the code :
int CReportMultilinePaintManager::GetRowHeight(CDC* pDC, CXTPReportRow* pRow){ if (pRow->IsGroupRow() || !pRow->IsItemsVisible()) return CXTPReportPaintManager::GetRowHeight(pDC, pRow);CXTPReportColumns* pColumns = pRow->GetControl()->GetColumns(); int nColumnCount = pColumns->GetCount();XTP_REPORTRECORDITEM_DRAWARGS drawArgs; drawArgs.pControl = pRow->GetControl(); drawArgs.pDC = pDC; drawArgs.pRow = pRow; int nHeight = 0; for (int nColumn = 0; nColumn < nColumnCount; nColumn++){ CXTPReportColumn* pColumn = pColumns->GetAt(nColumn); if (pColumn && pColumn->IsVisible()){ CXTPReportRecordItem* pItem = pRow->GetRecord()->GetItem(pColumn); drawArgs.pItem = pItem; XTP_REPORTRECORDITEM_METRICS itemMetrics; pRow->GetItemMetrics(&drawArgs, &itemMetrics); CXTPFontDC fnt(pDC, itemMetrics.pFont); CRect rcItem(0, 0, pColumn->GetWidth() - 4, 0); pRow->ShiftTreeIndent(rcItem, pColumn); pItem->GetCaptionRect(&drawArgs, rcItem); pDC->DrawText(pItem->GetCaption(pColumn), rcItem, DT_WORDBREAK|DT_CALCRECT); nHeight = max(nHeight, rcItem.Height()); } } return max(nHeight + 5, m_nRowHeight) + (IsGridVisible(FALSE)? 1: 0);} but when I added this class to my program , it seems that pItem->GetCaption(pColumn) always return an emptry string , and consequently GetRowHeight return 0 , is there another way to access my CXTPReportRecordItem and retreive the item text ? |
|
sserge
Moderator Group Joined: 01 December 2004 Status: Offline Points: 1297 |
Post Options
Thanks(0)
|
When you do use Virtual records, do not forget that actual text for an item is set after calling GetItemMetrics(...) method . So far, changing pItem->GetCaption(pColumn) in this code to itemMetrics.strText should help.
-- WBR, Serge |
|
stiff upper lip
Newbie Joined: 17 June 2006 Location: Russian Federation Status: Offline Points: 3 |
Post Options
Thanks(0)
|
hello sserge
thank you for the tip , i have replaced pItem->GetCaption(pColumn)
with itemMetrics.strText , then you have to add the following code to make it working ,
you have to add :
drawArgs.pColumn = pColumn;
before you call :
pRow->GetItemMetrics(&drawArgs, &itemMetrics);
now it working fine , thanks again
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |