Print Page | Close Window

Set Size of a Cell or a row

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=4086
Printed Date: 21 November 2024 at 3:24pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Set Size of a Cell or a row
Posted By: fakie
Subject: Set Size of a Cell or a row
Date Posted: 28 April 2006 at 7:37am
Hello everybody,

I like to change the size of my rows, but i don't know how to set the size of the rows. I created some rows, but they have fixed size and i don't know how change it. I change the size of my font, but the size of my rows didn't change. Can anyone say me how to set the size of my rows or of my cells. Thanks in advance.

Here is my code:
CXTPReportControl& wndReport = GetReportCtrl();
wndReport.AddColumn(new CXTPReportColumn(0,_T("Column1"),50));
wndReport.AddColumn(new CXTPReportColumn(1,_T("Column2"),50));
wndReport.AddColumn(new CXTPReportColumn(2,_T("Column3"),50));
wndReport.SetVirtualMode(new CVirtualRecord(), 5);

CVirtualRecord()
{
     CFont *simpleFont = new CFont;
     simpleFont->CreatePointFont(220, "Times New Roman");
     CXTPReportRecordItem *d=new CXTPReportRecordItem();         
     d->SetFont(simpleFont);
     d->SetBackgroundColor(RGB(243,245,253));

     AddItem(d);
     d=new CXTPReportRecordItem();
     d->SetFont(simpleFont);
     d->SetBackgroundColor(RGB(243,245,253));

     AddItem(d);
     d=new CXTPReportRecordItem();       
     d->SetFont(simpleFont);
     d->SetBackgroundColor(RGB(243,245,253));

     AddItem(d);
}


cu fakie



Replies:
Posted By: sserge
Date Posted: 28 April 2006 at 4:03pm
Do you want to change a height or a width of the row? 


Posted By: fakie
Date Posted: 01 May 2006 at 1:09am
Hello sserge,


I'd like to change the height of the row. I want to set the height by a value.

cu fakie


Posted By: sserge
Date Posted: 01 May 2006 at 5:18am
Hi,

You'll have to override GetHeight() method for your custom descendant class of CXTPReportRow. Note that you'll have also to override CXTPReportControl::CreateRow() to apply a custom Row class.

See also topics:
http://forum.codejock.com/forum_posts.asp?TID=2932 - http://forum.codejock.com/forum_posts.asp?TID=2932
http://forum.codejock.com/forum_posts.asp?TID=2984 - http://forum.codejock.com/forum_posts.asp?TID=2984

--
WBR,
Serge


Posted By: fakie
Date Posted: 02 May 2006 at 2:48am
Hello sserge,

Thx for your tipps.
I have tried this tutorial:
http://forum.codejock.com/forum_posts.asp?TID=2984 - http://forum.codejock.com/forum_posts.asp?TID=2984
 

and I have added the class VirtualRow to my program and I override the function getheight like this:
Class VirtualRow:public CXTPReportRow
{
...//some code
int VirtualRow::GetHeight(CDC* dc, int nWidth)
{
    dc->SetBkColor(RGB(0,0,0));
    m_nPreviewHeight=1000;
    m_rcRow.SetRect(10,10,10,10);
    dc->ExcludeClipRect(1,1,100,100);
    dc->Ellipse(1,1,20,255);
    return m_nIndex * 20 + 10;
}
}
but I don't know how to change the height of my row. If i call this function( getHeight( getDC(),120) ), it will take no effect. How can I adjust the height with the CDC object?

cu fakie




Posted By: sserge
Date Posted: 02 May 2006 at 5:29am
Hi,

Here is a working example of how to override GetHeight for a virtual row. You can insert those pieces of code into VirtualListView.cpp and play with it:

class CVirtualReportRow : public CXTPReportRow
{
public:
    CVirtualReportRow() : CXTPReportRow() { }
    virtual ~CVirtualReportRow() { }
   
    virtual int GetHeight(CDC* pDC, int nWidth)
    {
        return CXTPReportRow::GetHeight(pDC, nWidth) + 20;
    }
};

class CVirtualReportControl : public CXTPReportControl
{
public:
    virtual CXTPReportRow* CreateRow()
    {
        return new CVirtualReportRow();
    };
};

///...///

CVirtualListView::CVirtualListView()
{
    m_bColorize = FALSE;

    SetReportCtrl(new CVirtualReportControl());
}


--
WBR,
Serge



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net