怎样把文字做成图片?

 我来答
情狼YY
2010-02-18
知道答主
回答量:1
采纳率:0%
帮助的人:0
展开全部
只要将VB窗口内的需要部分保存成图片文件就可以了
要用到API函数的:
Private Type POINTAPI
x As Long
y As Long
End Type
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function DrawIcon Lib "user32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal hIcon As Long) As Long
Private Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long

Private Sub Command1_Click()
Dim hdc As Long
Dim sw As Integer
Dim sh As Integer
Dim CurPos As POINTAPI
Dim Cur As Long
Me.Hide
DoEvents
Picture1.AutoRedraw = True
hdc = GetDC(0)
GetCursorPos CurPos
Cur = GetCursor
Picture1.Width = Screen.Width
Picture1.Height = Screen.Height
sw = Screen.Width / Screen.TwipsPerPixelX
sh = Screen.Height / Screen.TwipsPerPixelY
BitBlt Picture1.hdc, 0, 0, sw, sh, hdc, 0, 0, vbSrcCopy
Me.Show
DrawIcon Picture1.hdc, CurPos.x - 10, CurPos.y - 10, Cur
ReleaseDC 0, hdc
Picture1.AutoRedraw = False

以下放到模块里:
Option Explicit

Type RECT_Type

left As Long
top As Long
right As Long
bottom As Long

End Type

'The following declare statements are case sensitive.

Declare Function GetActiveWindow Lib "User32" () As Long
Declare Function GetDesktopWindow Lib "User32" () As Long
Declare Sub GetWindowRect Lib "User32" (ByVal Hwnd As Long, _
lpRect As RECT_Type)
Declare Function GetDC Lib "User32" (ByVal Hwnd As Long) As Long
Declare Function CreateCompatibleDC Lib "Gdi32" (ByVal hdc As Long) _
As Long
Declare Function CreateCompatibleBitmap Lib "Gdi32" (ByVal hdc _
As Long, ByVal nWidth As Long, _
ByVal nHeight As Long) As Long
Declare Function SelectObject Lib "Gdi32" (ByVal hdc As Long, _
ByVal hObject As Long) As Long
Declare Function BitBlt Lib "Gdi32" (ByVal hDestDC As Long, _
ByVal X As Long, ByVal Y _
As Long, ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal hSrcDC As Long, _
ByVal XSrc As Long, _
ByVal YSrc As Long, _
ByVal dwRop As Long) As Long
Declare Function OpenClipboard Lib "User32" (ByVal Hwnd As Long) As Long
Declare Function EmptyClipboard Lib "User32" () As Long
Declare Function SetClipboardData Lib "User32" (ByVal wFormat As Long, _
ByVal hMem As Long) As Long
Declare Function CloseClipboard Lib "User32" () As Long
Declare Function ReleaseDC Lib "User32" (ByVal Hwnd As Long, _
ByVal hdc As Long) As Long
Declare Function DeleteDC Lib "Gdi32" (ByVal hdc As Long) As Long
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Global Const SRCCOPY = &HCC0020
Global Const CF_BITMAP = 2

Function ScreenDump()
Dim AccessHwnd As Long, DeskHwnd As Long
Dim hdc As Long
Dim hdcMem As Long
Dim rect As RECT_Type
Dim junk As Long
Dim fwidth As Long, fheight As Long
Dim hBitmap As Long

' DoCmd.Hourglass True

'---------------------------------------------------
' Get window handle to Windows and Microsoft Access
'---------------------------------------------------
DoEvents
DeskHwnd = GetDesktopWindow()
AccessHwnd = GetActiveWindow()

'---------------------------------------------------
' Get screen coordinates of Microsoft Access
'---------------------------------------------------
Call GetWindowRect(AccessHwnd, rect)
fwidth = rect.right - rect.left
fheight = rect.bottom - rect.top

'---------------------------------------------------
' Get the device context of Desktop and allocate memory
'---------------------------------------------------
hdc = GetDC(DeskHwnd)
hdcMem = CreateCompatibleDC(hdc)
hBitmap = CreateCompatibleBitmap(hdc, fwidth, fheight)

If hBitmap <> 0 Then
junk = SelectObject(hdcMem, hBitmap)

'---------------------------------------------
' Copy the Desktop bitmap to memory location
' based on Microsoft Access coordinates.
'---------------------------------------------
junk = BitBlt(hdcMem, 0, 0, fwidth, fheight, hdc, rect.left, _
rect.top, SRCCOPY)

'---------------------------------------------
' Set up the Clipboard and copy bitmap
'---------------------------------------------
junk = OpenClipboard(DeskHwnd)
junk = EmptyClipboard()
junk = SetClipboardData(CF_BITMAP, hBitmap)
junk = CloseClipboard()
End If

'---------------------------------------------
' Clean up handles
'---------------------------------------------
junk = DeleteDC(hdcMem)
junk = ReleaseDC(DeskHwnd, hdc)

' DoCmd.Hourglass False

End Function

这里是拖动鼠标的框里内容截取,你也可以改成固定范围的截取。

1回答者: redfoxgc - 试用期 二级 2009-9-4 19:14

我来评论>> 相关内容
• VB 如何将窗体生成JPG图片 2006-12-22
• 请问在VB中要添加一张图片,如何使它充满整个窗体? 2008-6-5
• vb中窗体中的图片如何设置可以使其覆盖整个窗体 2006-11-1
• VB中form窗体的背景图片如何调整属性使背景图片的大小和窗体大小一样 2008-12-17
• 各位大虾:我遇到一个问题,在vb的多文档窗口中添加背景图片后,这个图片如何才能使其与窗体一起放大缩小 2007-1-31
更多相关问题>>
查看同主题问题: 生成 图片 窗体
其他回答 共 8 条
不知道你所谓的清晰是达到什么样的程度..
假如你的学生数据是整理好的,这个东西倒不难做

回答者: fender_x - 中级经理 八级 2009-9-4 19:06

呵呵,这个项目不错。我可以试试。。

回答者: 房恩宏 - 军侯 八级 2009-9-4 19:06

天亿截图圣手软件

回答者: ljx_1399 - 试用期 二级 2009-9-4 19:30

下面分二步介绍如何把VB得部分窗体生成图片(清晰的)

一、建立一个模块,复制下面代码:

'=============模块开始=================
Option Explicit

Private Type PALETTEENTRY
peRed As Byte
peGreen As Byte
peBlue As Byte
peFlags As Byte
End Type

Private Type LOGPALETTE
palVersion As Integer
palNumEntries As Integer
palPalEntry(255) As PALETTEENTRY
End Type

Private Type GUID
Data1 As Long
Data2 As Integer
Data3 As Integer
Data4(7) As Byte
End Type

Private Const RASTERCAPS As Long = 38
Private Const RC_PALETTE As Long = &H100
Private Const SIZEPALETTE As Long = 104

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

Private Declare Function CreateCompatibleDC Lib "GDI32" (ByVal hDC As Long) As Long
植思萱竭水
2019-10-30 · TA获得超过3万个赞
知道大有可为答主
回答量:1.1万
采纳率:26%
帮助的人:706万
展开全部
可以用qq截图也行,按ctrl+a后,在一个地方框起来——按就截图工具栏上的A后打上字——保存就ok了
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
荆芳菲力苍
2019-08-23 · TA获得超过3万个赞
知道大有可为答主
回答量:1.1万
采纳率:34%
帮助的人:746万
展开全部
楼主
ps么?会的话,你可以新建一个空白的文档,然后点文字工具
到那里写你需要的字就可以
不会的话
,就用截图也行啊
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
敬扬圭景天
2019-09-23 · TA获得超过3936个赞
知道大有可为答主
回答量:2999
采纳率:27%
帮助的人:455万
展开全部
用ps
写好字以后直接栅格化就可以转换成图片的形式
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
尉原阮心诺
2020-03-12 · TA获得超过3734个赞
知道大有可为答主
回答量:3073
采纳率:32%
帮助的人:185万
展开全部
右击文字图层,选择删除格式化
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(8)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式