Print Page | Close Window

Display JPEG pics in reportcontrol preview mode

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=17381
Printed Date: 29 September 2024 at 9:29am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Display JPEG pics in reportcontrol preview mode
Posted By: unknow
Subject: Display JPEG pics in reportcontrol preview mode
Date 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;)



Replies:
Posted By: unknow
Date 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.


Posted By: Marco1
Date 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.



-------------
Product: XTP 18.3.0 on VS 2017
Platform: VS 2017 / Windows 10 (64bit)


Posted By: unknow
Date 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;



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