Part 1ArticleI wrote in VB and used the iprintview interface of the Xtreme command bars ActiveX Control to draw a graph. However, I found a fatal problem. There was no problem during previewing, But when I output the image to the printer, it was a piece
Black, so the previous articleCodeInvalid. The code is re-updated to solve the above problem
The principle of this implementation is to re-paint the pixels one by one.
First, use the iprintview interface class,
Implements iprintviewprivate type rect left as long top as long right as long bottom as longend typeprivate sub iprintview_beginprinting (byval HDC as long, byval hattribdc as long, byval printinfo as xtremecommandbars. printinfo) end subprivate sub iprintview_endprinting (byval HDC as long, byval hattribdc as long, byval printinfo as xtremecommandbars. printinfo) end subprivate sub iprintview_preparedc (byval HDC as long, byval hattribdc as long, byval printinfo as xtremecommandbars. printinfo) end subprivate sub iprintview_prepareprinting (byval printinfo as xtremecommandbars. printinfo) printinfo. maxpage = 1 end subprivate sub iprintview_printpage (byval HDC as long, byval hattribdc as long, byval printinfo as xtremecommandbars. printinfo) dim R as rect R. left = printinfo. printrectleft R. top = printinfo. printrecttop R. right = printinfo. printrectright R. bottom = printinfo. printrectbottomif not printinfo. previewmode thenzoomimage 4500,450 0end ifmemoutput HDC, falseend sub
Then the call class
WithPic1
. Autoredraw =True
. Appearance =0
. Borderstyle =0
. Scalemode =3
End With
W = pic1.scalewidth
H = pic1.scaleheight
Memget pic1.hdc,0,0, W-1, H-1
SetForm7.printpreview. printview = CLS
Form7.show vbmodal
Then download the relevant function module.