关于vb.net打印翻转文字的信息
VB.NET中怎么在图片上直接输出文字。向VB中有Print的方法
两种方法:
创新互联是一家专业提供尼泸西企业网站建设,专注与网站建设、成都网站设计、H5技术、小程序制作等业务。10年已为尼泸西众多企业、政府机构等服务。创新互联专业的建站公司优惠进行中。
图片框上盖个Label 向其输入内容。
载入图片,通过内存直接 DrawImage绘制个新图,然后在图上盖文字。最后赋值给图片框。
VB6的print 实质是向图片框打印文字,不管有无图都能在上面Print. 考虑速度和实现难度问题,如果纯粹显示,最好直接盖个Label最简单。第二种方法 需要考虑文字大小、颜色、坐标定位等等。如果一行文字显示不下,不会自动换行,得自己切。
高分求助,如何在VB.NET中做任意角度的旋转字体
文字编辑结束后,选择“移动”工具(工具箱第一个工具,快捷键V),然后按Ctrl+T快捷键进行“自由变换”,会在文字上出现控制框,把鼠标移到控制框外边指针就会变成旋转的样式,按住鼠标左键拖动就可以进行任意角度旋转了。
VB编程: 在picturebox中print 文字,文字要求旋转90°
Option Explicit
' 逻辑字体
Public Const LF_FACESIZE = 32 ' 最长的字体名称
Public Const SYSTEM_FONT = 13
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(LF_FACESIZE) As Byte
End Type
' 字体的族
Public Const VARIABLE_PITCH = 2
Public Const FF_DONTCARE = 0 ' 无所谓
Public Const FF_ROMAN = 16 ' 字体宽度可变,Times Roman, Century ' Schoolbook等
Public Const FF_SWISS = 32 ' 宽度可变,带衬线,如Helvetica, Swiss等
Public Const FF_MODERN = 48 ' 具有规定的宽度,衬线可有可无,
' 如Pica, Elite, Courier等等.
Public Const FF_SCRIPT = 64 ' 手写体,如Cursive
Public Const FF_DECORATIVE = 80 ' 特殊字体,如Old English
' GDI字体函数
Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long
Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Declare Function GetStockObject Lib "gdi32" (ByVal nIndex As Long) As Long
Declare Function GDIGetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
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
Declare Function lstrlen Lib "KERNEL32" Alias "lstrlenA" (ByVal lpString As String) As Long
Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
Sub RotPrint(ByVal hDestDC As Long, Text As String, x As Double, y As Double, LineAngle As Double)
Dim hFont As Long, hOldFont As Long, R As Long
Dim Font As LOGFONT
hOldFont = SelectObject(hDestDC, GetStockObject(SYSTEM_FONT))
GDIGetObject hOldFont, Len(Font), Font
' 填充LOGFONT结构
Font.lfEscapement = LineAngle * 10 ' 输出字体行与水平页底间的角度(以1/10度为单位)
' 必须是可变点字体
Font.lfPitchAndFamily = VARIABLE_PITCH Or FF_DONTCARE
' 创建字体
hFont = CreateFontIndirect(Font)
' 选择旋转字体
R = SelectObject(hDestDC, hFont)
' 显示字体
TextOut hDestDC, x, y, Text, lstrlen(Text)
' 恢复原字体
hFont = SelectObject(hDestDC, hOldFont)
' 删除创建的字体
DeleteObject hFont
'DeleteObject hOldFont
End Sub
网站栏目:关于vb.net打印翻转文字的信息
URL网址:http://pwwzsj.com/article/hsciip.html