如何设置打印字体的方向?
如题在普通A4打印机上打印文字为竖直的
如何将其设置为横向的字体呢?
谢谢
还是不能实现? 意思是 把文字向右旋转90度吗? [quote][bo]以下是引用 [un]论坛元老[/un] 在 2008-4-10 13:54 的发言:[/bo]
意思是 把文字向右旋转90度吗? [/quote]
对就是这个意思!
谢谢! 可以啊,你在word里把字体旋转好了,再打印出来不就可以了吗? [quote][bo]以下是引用 [un]论坛元老[/un] 在 2008-4-10 14:05 的发言:[/bo]
可以啊,你在word里把字体旋转好了,再打印出来不就可以了吗? [/quote]
前辈在拿我开玩笑了..
我是在编写VB程序
通过PRINTER对象来打印文字
默认都是竖直的
我想打成横向的
而且就几个字,调用WORD是不是有点劳师动众了 哦,没听明白你的意思 我把文字打印在A4纸上
在确定了位置
printer.currentx
printer.currentY
printer.print "文字"
我们暂且把A4纸的较短的边为宽,长边为高
这样A4纸就竖立起来了
这样打印出来的文字是竖直的
我想把文字打印成横向的.... 如果在不明白
我只能给你画图了.... 在窗体上添加个command按钮
然后复制以下代码就可以了
Option Explicit
Private Const FW_NORMAL = 400
Private Const ANSI_CHARSET = 0
Private Const FF_MODERN = 48
Private Const PROOF_QUALITY = 2
Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal lpString As String, ByVal nCount As Long) As Long
Private Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long
Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Type LOGFONT
lfHeight As Long
lfWidth As Long
lfEscapement As Long
lfOrientation As Long
lfWeight As Long
lfItalic As Byte
lfUnderline As Byte
lfStrikeOut As Byte
lfCharSet As Byte
lfOutPrecision As Byte
lfClipPrecision As Byte
lfQuality As Byte
lfPitchAndFamily As Byte
lfFaceName As String * 20
End Type
Dim MyFont As LOGFONT
Const OutString = " 测试哈 文字 yingyu 123 "
Const X = 100
Const Y = 400
Private Sub Command1_Click()
Dim hFont As Long
Dim hOldFont As Long
hFont = CreateFontIndirect(MyFont) '建立逻辑字体
hOldFont = SelectObject(Me.hdc, hFont) '选入设备环境
TextOut Me.hdc, X, Y, OutString, Len(OutString) '输出逻辑字体
hFont = SelectObject(Me.hdc, hOldFont) '恢复设备环境
DeleteObject hFont
End Sub
Private Sub Form_Load()
Dim Angle As Integer
Angle = 90 '输出角度
MyFont.lfHeight = 18
' MyFont.lfWidth = 0
MyFont.lfEscapement = Angle * 10
' MyFont.lfWeight = FW_NORMAL
' MyFont.lfCharSet = ANSI_CHARSET
' MyFont.lfPitchAndFamily = FF_MODERN
' MyFont.lfQuality = PROOF_QUALITY
End Sub 如果看不见文字就改写
Const X = 100
Const Y = 400
这2个值
分别代表 横 纵 坐标 kvldfutgkjdi e kwfh tyv wfk i yj ip
[img]http://photo10.zxip.com/albums10/folder3/1680/20050628180221/200842851424540.gif[/img]
[url=http://dz.dzt.cc]电子书[/url] q krgetgkun gk
[img]http://photo10.zxip.com/albums10/folder3/1680/20050628180221/200842851424540.gif[/img]
[url=http://www.gengxin.la/About.aspx?BookID=7357]重生成妖[/url]
页:
[1]
