如何在PictureBox中显示文字?

MMABing 2001-06-19 09:04:00
如何在PictureBox中显示文字?
...全文
876 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
Pipi0714 2001-06-20
  • 打赏
  • 举报
回复
jisheng 2001-06-19
  • 打赏
  • 举报
回复
Private Sub Command1_Click()
p.CurrentX = 10
p.CurrentY = 300
p.Print "世界,你好!(Hello world!)"
End Sub

注:p是picturebox的name
xxlroad 2001-06-19
  • 打赏
  • 举报
回复
同意wangfeng(VB比较会,想学VC) 
如果要用picture1.print "MMABing"
最好先用一下picture1.pset(x,y)定位
kyuwong 2001-06-19
  • 打赏
  • 举报
回复
Private Declare Function DrawStateString Lib "user32" Alias "DrawStateA" (ByVal hdc As Long, _
ByVal hBrush As Long, _
ByVal lpDrawStateProc As Long, _
ByVal lpString As String, _
ByVal cbStringLen As Long, _
ByVal X As Long, _
ByVal Y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal fuFlags As Long) As Long

DrawStateString Picturt.hdc ,0,0 ,"你好!",LenB(StrConv("你好!",vbFromUnicode)), 10,10, 100,100,2 or Normal
最后的一个参数设置效果
Normal = 0
DISABLED = &H20&
lionelcai 2001-06-19
  • 打赏
  • 举报
回复
我用的也是jisheng(古朴的狼)的方法。
wangfeng 2001-06-19
  • 打赏
  • 举报
回复
把TABLE或TEXT控件直接放进去!
然后你,想怎么样就怎么样!!!
DeD 2001-06-19
  • 打赏
  • 举报
回复
Option Explicit
Private Const DT_LEFT = &H0
Private Const DT_WORDBREAK = &H10

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

Private Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long


Private Sub Command1_Click()
Dim strTmp As String, nCount As Integer, m_Rect As RECT
Dim i As Long
strTmp = Text1.Text
For i = 1 To Len(strTmp)
If VBA.Asc(Mid(strTmp, i, 1)) < 0 Then
nCount = nCount + 2
Else
nCount = nCount + 1
End If
Next
'以下以象数为单位
m_Rect.Left = 10
m_Rect.Right = 200
m_Rect.Top = 10
m_Rect.Bottom = 200
DrawText Picture1.hdc, strTmp, nCount, m_Rect, DT_LEFT Or DT_WORDBREAK

End Sub


pp616 2001-06-19
  • 打赏
  • 举报
回复
用print方法就好了。
很多控件都有print方法。窗体也有。你可以直接向上面打印文字。
TechnoFantasy 2001-06-19
  • 打赏
  • 举报
回复
PictureBox.Print
xxlroad 2001-06-19
  • 打赏
  • 举报
回复
jisheng(古朴的狼) 说的很对

7,789

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧