惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 聂微东
博客园 - 【当耐特】
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
Check Point Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
美团技术团队
WordPress大学
WordPress大学
Last Week in AI
Last Week in AI
Y
Y Combinator Blog
IT之家
IT之家
T
Tailwind CSS Blog
月光博客
月光博客
Vercel News
Vercel News
V
V2EX
Engineering at Meta
Engineering at Meta
B
Blog
Stack Overflow Blog
Stack Overflow Blog
A
About on SuperTechFans
Hugging Face - Blog
Hugging Face - Blog
人人都是产品经理
人人都是产品经理
腾讯CDC
I
InfoQ

博客园 - 王跃军

成本安全硬件(二):RFID on PN532 之WINDOWS 环境应用 C# 委托的三种调用示例(同步调用 异步调用 异步回调) 之 FUNC 版 vb中使用Xtreme Command Bars ActiveX Control 的IPrintView接口绘制图形 android开发专题系列-OPENGL android开发专题系列-Android开发指南 android开发专题系列-一个简单的游戏的设计 android网站汇集 android开发资料(DEVELOPER.ANDROID.COM/SDK)WORD版 可也extJs相媲美的js 控件集 DHTMLX 对ASP.NET 安全方面的一些理解 ANDROID 开发资源网站列表(2008年1月14日) [转]林西:企业信息化规划方法 [收藏]DIV+CSS布局积累 [转]常用SQL 深入实例理解 [转]可用表格样式表 DataSet 加载XML 数据效果 纯ajax式,多用户选择示例 asp.net全局异常处理 也nhibernate会遇到问题,还好找到原因了
vb中使用Xtreme Command Bars ActiveX Control 的IPrintView...
王跃军 · 2012-01-16 · via 博客园 - 王跃军

上篇文章 写了vb中使用Xtreme Command Bars ActiveX Control 的IPrintView接口绘制图形,但后来发现有个致命的问题,预览时没有问题,但实际输出到打印机时,则是一片

黑色,所以上篇代码无效.现重新上代码,解决以上问题的

本次实现原理是像素获取后,再逐个重绘出来.

首先还是使用IPrintView接口的类,

Implements IPrintView
Private Type RECT
        Left As Long
        Top As Long
        Right As Long
        Bottom As Long
End Type


Private Sub IPrintView_BeginPrinting(ByVal hdc As Long, ByVal hAttribDC As Long, ByVal PrintInfo As XtremeCommandBars.PrintInfo)




End Sub


Private Sub IPrintView_EndPrinting(ByVal hdc As Long, ByVal hAttribDC As Long, ByVal PrintInfo As XtremeCommandBars.PrintInfo)

End Sub

Private Sub IPrintView_PrepareDC(ByVal hdc As Long, ByVal hAttribDC As Long, ByVal PrintInfo As XtremeCommandBars.PrintInfo)

End Sub

Private Sub IPrintView_PreparePrinting(ByVal PrintInfo As XtremeCommandBars.PrintInfo)
    PrintInfo.MaxPage = 1
    
End Sub

Private 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.PrintRectBottom
If Not PrintInfo.PreviewMode Then
ZoomImage 4500, 4500
End If

MemOutPut hdc, False



End Sub

  然后是调用类

With Pic1
.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

Set Form7.PrintPreview.PrintView = cls
Form7.Show vbModal

然后是相关的函数模块下载