Very small chart using PrintToDC |
Post Reply |
Author | |
robertmdc
Newbie Joined: 23 May 2011 Status: Offline Points: 4 |
Post Options
Thanks(0)
Posted: 28 May 2011 at 5:00am |
On screen, this is my chart:
To print, I use PrintToDC method (VB6): Printer.Print " "; ChartControl.PrintToDC Printer.hDC, 500, 500, 3000, 3000 Printer.EndDoc ...on Printer Why chart and labels are very small? How to print chart like "wysiwhg" using PrintToDC method? |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Most easy way is to use our PrintPreview control from CommandBars.
for 15.0.3 we added new methods to show PrintPreview and send to printer.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Fabian
Senior Member Joined: 22 November 2004 Location: Switzerland Status: Offline Points: 336 |
Post Options
Thanks(0)
|
Hi Robertmdc
Probably the following code snippet in VB6 will help. but the result still depends on the printer resolution (BTW: I use the VSPrinter as canvas control):
Public Sub DrawChart(VSPrinter1 As VSPrinter, ChartControl1 As ChartControl, ByVal x1 As Long, ByVal y1 As Long, ByVal x2 As Long, ByVal y2 As Long, Optional ByVal AsBitmap_OK As Boolean = False)
Const MM_ISOTROPIC = 7 Const MM_ANISOTROPIC = 8 Dim Path As String Dim OldMapMode As Long Dim OldVE As POINTAPI Dim OldWE As POINTAPI Dim OldOrg As POINTAPI Dim OldSize As POINTAPI Dim PW As Long Dim ph As Long If AsBitmap_OK Then Path = GetTempPathName() + ".BMP" Call ChartControl1.SaveAsImage(Path, (x2 - x1) / Screen.TwipsPerPixelX, (y2 - y1) / Screen.TwipsPerPixelY) Call VSPrinter1.DrawPicture(LoadPicture(Path), x1, y1, x2 - x1, y2 - y1) Call KillFiles(Path) Else PW = (VSPrinter1.PageWidth - 1440) / VSPrinter1.TwipsPerPixelX ph = (VSPrinter1.PageHeight - 1440) / VSPrinter1.TwipsPerPixelY / 3 OldMapMode = SetMapMode(VSPrinter1.hDC, MM_ISOTROPIC) Call SetWindowOrgEx(VSPrinter1.hDC, 0, 0, OldOrg) Call SetWindowExtEx(VSPrinter1.hDC, PW, ph, OldWE) Call SetViewportExtEx(VSPrinter1.hDC, PW / 100, ph / 100, OldVE) Call ScaleViewportExtEx(VSPrinter1.hDC, 1200 / VSPrinter1.TwipsPerPixelX, 1, 1200 / VSPrinter1.TwipsPerPixelY, 1, OldSize) Call ChartControl1.PrintToDC(VSPrinter1.hDC, x1 / 12, y1 / 12, (x2 - x1) / 12, (y2 - y1) / 12) Call SetWindowOrgEx(VSPrinter1.hDC, OldOrg.x, OldOrg.y, OldOrg) Call SetViewportExtEx(VSPrinter1.hDC, OldVE.x, OldVE.y, 0) Call SetWindowExtEx(VSPrinter1.hDC, OldWE.x, OldWE.y, 0) Call SetMapMode(VSPrinter1.hDC, OldMapMode) End If End Sub |
|
Product: Xtreme SuitePro (ActiveX) version 16.2.3
Platform: Windows 7 (32bit) Language: Visual Basic 6.0 / SP6 |
|
robertmdc
Newbie Joined: 23 May 2011 Status: Offline Points: 4 |
Post Options
Thanks(0)
|
Hi Fabian
Thank you! Everything works fine! |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |