CXTPReportPaintManager::DrawBitmap
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=13758
Printed Date: 16 May 2024 at 7:08pm Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: CXTPReportPaintManager::DrawBitmap
Posted By: zitz
Subject: CXTPReportPaintManager::DrawBitmap
Date Posted: 23 March 2009 at 4:18am
I use Xtreme ToolkitPro v13.0.0, static.
int CXTPReportPaintManager::DrawBitmap(CDC* pDC, CXTPReportControl* pControl, CRect rcColumn, int iIcon) { ASSERT(pControl); if (!pControl) return 0;
POINT ptIcon;
CXTPImageManagerIcon* pIcon = pControl->GetImageManager()->GetImage(iIcon, 0);
if (!pIcon) return 0;
CSize szImage(pIcon->GetWidth(), pIcon->GetHeight()); CSize szColumn(rcColumn.Size());
if (szImage.cx < szColumn.cx && szImage.cy < szColumn.cy && pDC) { ptIcon.x = rcColumn.left + 1; ptIcon.y = rcColumn.top + (szColumn.cy - szImage.cy) /2;
if (pDC->IsPrinting()) { CBitmap bmp; bmp.CreateCompatibleBitmap(pDC, szImage.cx, szImage.cy); CXTPCompatibleDC dcMem(NULL, &bmp); dcMem.FillSolidRect(0, 0, szImage.cx, szImage.cy, pDC->GetBkColor());
pIcon->Draw(&dcMem, CPoint(0, 0), pIcon->GetIcon()); pDC->BitBlt(ptIcon.x, ptIcon.y, szImage.cx, szImage.cy, &dcMem, 0, 0, SRCCOPY); } else { pIcon->Draw(pDC, ptIcon, pIcon->GetIcon()); } }
return 1 + szImage.cx; } |
For what if printing is drawn to another way? Drawn is not transparent :( What do I lose if you remove this block? Or how to fix transparent?
|
Replies:
Posted By: mdoubson
Date Posted: 24 March 2009 at 8:22pm
I like your questions. Why don't try yourself and share your experience. It is easy...
Btw - does ALL printers able to make nice transparent output? I am not sure...
------------- Mark Doubson, Ph.D.
|
Posted By: zitz
Date Posted: 25 March 2009 at 3:02am
I am not a specialist in printing and do not face problems with printing. I see strange code and I think the developers did not just write it for fun.
I use the printer Samsung SCX-4300, and when I removed this block it prints well without problems. Where can I read more information on this issue?
|
Posted By: zitz
Date Posted: 25 March 2009 at 3:18am
Posted By: zitz
Date Posted: 25 March 2009 at 3:26am
Is not only I use program. I should know about the problems of my users, preferably in advance.
|
Posted By: mdoubson
Date Posted: 25 March 2009 at 8:31am
Try Google it, e.g. http://help.wugnet.com/office2/Transparent-image-prints-slightly-shaded-ftopict846706.html - http://help.wugnet.com/office2/Transparent-image-prints-slightly-shaded-ftopict846706.html
------------- Mark Doubson, Ph.D.
|
Posted By: zitz
Date Posted: 25 March 2009 at 10:24am
Thank you, Mark!!! I recognize the problem!
Here is a solution for me:
static int stDrawBitmaps( CDC* pDC, CXTPReportControl* pControl, CRect rcColumn, int iIcon1, int iIcon2 ) { ASSERT(pControl); if (!pControl) return 0;
POINT ptIcon;
CXTPImageManagerIcon* pIcon1 = pControl->GetImageManager()->GetImage( iIcon1, 0 ); CXTPImageManagerIcon* pIcon2 = pControl->GetImageManager()->GetImage( iIcon2, 0 );
if ( !pIcon1 ) return 0;
CSize szImage( pIcon1->GetWidth(), pIcon1->GetHeight() ); CSize szColumn( rcColumn.Size() );
if ( szImage.cx < szColumn.cx && szImage.cy < szColumn.cy && pDC ) { ptIcon.x = rcColumn.left + 1; ptIcon.y = rcColumn.top + (szColumn.cy - szImage.cy) /2;
if (pDC->IsPrinting()) { CBitmap bmp; bmp.CreateCompatibleBitmap( pDC, szImage.cx, szImage.cy ); CXTPCompatibleDC dcMem( NULL, &bmp ); dcMem.FillSolidRect( 0, 0, szImage.cx, szImage.cy, pDC->GetBkColor() ); pIcon1->Draw( &dcMem, CPoint( 0, 0 ), pIcon1->GetIcon() ); if ( pIcon2 != NULL ) pIcon2->Draw( &dcMem, CPoint( 0, 0 ), pIcon2->GetIcon() ); pDC->BitBlt( ptIcon.x, ptIcon.y, szImage.cx, szImage.cy, &dcMem, 0, 0, SRCCOPY ); } else { pIcon1->Draw( pDC, ptIcon, pIcon1->GetIcon() ); if ( pIcon2 != NULL ) pIcon2->Draw( pDC, ptIcon, pIcon2->GetIcon() ); } }
return 1 + szImage.cx; } |
|
|