Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Set Size of a Cell or a row
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Set Size of a Cell or a row

 Post Reply Post Reply
Author
Message
fakie View Drop Down
Newbie
Newbie


Joined: 28 April 2006
Location: Germany
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote fakie Quote  Post ReplyReply Direct Link To This Post Topic: Set Size of a Cell or a row
    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
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post Posted: 28 April 2006 at 4:03pm
Do you want to change a height or a width of the row? 
Back to Top
fakie View Drop Down
Newbie
Newbie


Joined: 28 April 2006
Location: Germany
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote fakie Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post 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=2984

--
WBR,
Serge
Back to Top
fakie View Drop Down
Newbie
Newbie


Joined: 28 April 2006
Location: Germany
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote fakie Quote  Post ReplyReply Direct Link To This Post 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
 

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


Back to Top
sserge View Drop Down
Moderator Group
Moderator Group


Joined: 01 December 2004
Status: Offline
Points: 1297
Post Options Post Options   Thanks (0) Thanks(0)   Quote sserge Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.