Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - Display JPEG pics in reportcontrol preview mode
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Display JPEG pics in reportcontrol preview mode

 Post Reply Post Reply
Author
Message
unknow View Drop Down
Groupie
Groupie
Avatar

Joined: 14 January 2009
Location: Belgium
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote unknow Quote  Post ReplyReply Direct Link To This Post Topic: Display JPEG pics in reportcontrol preview mode
    Posted: 05 October 2010 at 6:56pm
Hi there;
 
I'm looking for a way to display a small jpeg picture for each report control row, either in regular mode but more in the preview mode.
 
I'm not looking for an icon from resources, but a real jpeg picture loaded from disk; possibly a size large enough like 64x64 or 100x100;
 
How can this be achieved ??
 
Thanks;)
Back to Top
unknow View Drop Down
Groupie
Groupie
Avatar

Joined: 14 January 2009
Location: Belgium
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote unknow Quote  Post ReplyReply Direct Link To This Post Posted: 11 October 2010 at 4:07am

Hi, just a little bump ; please no one has a hint on how to do this ?

Is it a possible enhancement request ?
 
Thankx.
Back to Top
Marco1 View Drop Down
Senior Member
Senior Member


Joined: 16 January 2004
Location: Germany
Status: Offline
Points: 251
Post Options Post Options   Thanks (0) Thanks(0)   Quote Marco1 Quote  Post ReplyReply Direct Link To This Post Posted: 11 October 2010 at 6:58am
I don't know what you mean with "preview mode".
Drawing a JPEG in a report cell is not a big problem. Look at the CJ example "ReportControl.CustomDrawReport". In this example you see, how to custom draw a cell.

Then you create your own CXTPCustomDrawReportPaintManager and override GetRowHeight to return your desired row (picture) height.

To draw the bitmap, you create your own CXTPReportRecordItem (CReportRecordItemBitmap here) and override OnDrawCaption, do something (simplyfied) like this:

void CReportRecordItemBitmap::OnDrawCaption(XTP_REPORTRECORDITEM_DRAWARGS* pDrawArgs, XTP_REPORTRECORDITEM_METRICS* pMetrics)
{
  if (!(pDrawArgs && pMetrics))
    return;

  // draw bitmap
  CDC memDC;
  memDC.CreateCompatibleDC(pDrawArgs->pDC);
  CBitmap *pOldbmp = memDC.SelectObject(&m_bitmap);
  if (!m_bitmap.m_hObject) {
    return;
  }

  BITMAP bi;
  m_bitmap.GetBitmap(&bi);

  // ... calculate image size here

  pDrawArgs->pDC->SetStretchBltMode(COLORONCOLOR);
  pDrawArgs->pDC->StretchBlt(... , &memDC, 0, 0, ..., ..., SRCCOPY);
  memDC.SelectObject(pOldbmp);
}


That's it.

Back to Top
unknow View Drop Down
Groupie
Groupie
Avatar

Joined: 14 January 2009
Location: Belgium
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote unknow Quote  Post ReplyReply Direct Link To This Post Posted: 19 October 2010 at 6:45pm
Thanks for the hints ;)
 
Here's what I'd like to achieve:
 
1: Display a bmp/gif/jpeg/png loaded from disk within column/rows (each row different bitmap) of the reportcontrol, for example to insert a preview of the picture file within the report control
 
2: load a bitmap from resources (used in the software as an ImageList) to display 32x32 pix icons instead of the small 16x16 from the ImageList.
 
Is there additional code to modify (except for loading and converting the bitmap) ?
 
thankx;
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.172 seconds.