VB6.0中在窗体或图片框输出文字用show和 print方法,net中咋弄?

lygdwl 2009-05-26 02:55:03
VB6.0中在窗体或图片框输出文字用show和 print方法,net中咋弄?
例如我就要在窗体输出“VB6.0中在窗体或图片框输出文字用show和 print方法,net中咋弄?
”代码咋写?
有答案就结贴!
...全文
827 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
lygdwl 2009-05-26
  • 打赏
  • 举报
回复
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim g As Graphics
g = Me.PictureBox1.CreateGraphics
g.DrawString("VB6.0中在窗体或图片框输出文字用 " & Chr(13) & Chr(10) & "show和 print方法,net中咋弄?", Me.Font, Brushes.Red, 2, 5)
g.Dispose()
End Sub


End Class

在网上搜了半天,这是我弄的
古今多少事 2009-05-26
  • 打赏
  • 举报
回复
在窗体上写:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim g As Graphics
Show()
g = Me.CreateGraphics()
g.DrawString("123", Me.Font, Brushes.Green, 0, 0)
End Sub
lygdwl 2009-05-26
  • 打赏
  • 举报
回复
Public Class Form1

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim _Graphics As Graphics = Graphics.FromHwnd(PictureBox1.Handle)

_Graphics.DrawString("123", Me.Font, Brushes.Green, 0, 0)
End Sub
End Class

改成这样错误没了,但什么也没有看到
lygdwl 2009-05-26
  • 打赏
  • 举报
回复
我学Net才二天,LS的代码放在程序,有好多异常,处理不了.
zgke 2009-05-26
  • 打赏
  • 举报
回复
使用Graphics

Graphics _Graphcis = Graphics.FromHdc(pictureBox1.Handle);
_Graphcis.DrawString("123", this.Font, Brushes.Yellow, 0, 0);
_Graphcis.Dispose();
lygdwl 2009-05-26
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 joeandlily 的回复:]
PictureBox1.Load("c:\1.bmp")
[/Quote]
是输出文字,不是加载图片
joeandlily 2009-05-26
  • 打赏
  • 举报
回复
PictureBox1.Load("c:\1.bmp")

16,553

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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