-
vb.net教程之打印文字
.打印文字。
方法一:在窗体上打印文字
Dim mFont As New Font("宋体", 18)
g.DrawString("测试", mFont, mBrush, 0, 10)
(0 为横坐标,10 为纵坐标)
方法二:在窗体上画文字
Dim m As Graphics
m = Me.CreateGraphics
m.DrawString("This is a diagonal line drawn on the control", _
New Font("Arial", 10), Brushes.Gold, New PointF(300.0F, 444.0F))
m.Dispose()
方法三:在图片框上打印文字
Public Class Form2
' This example creates a PictureBox control on the form and draws to it.
' This example assumes that the Form_Load event handler method is connected
' to the Load eventof the form.
Private pictureBox1 As New PictureBox()
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' Dock the PictureBox to the form andset its background to white.
pictureBox1.Dock = DockStyle.Fill
pictureBox1.BackColor = Color.White
' Connect the Paint eventof the PictureBox to the event handler method.
Ø AddHandler pictureBox1.Paint, AddressOf Me.pictureBox1_Paint
' Add the PictureBox control to the Form.
Me.Controls.Add(pictureBox1)
End Sub 'Form1_Load
00:00:03.9522260
Private Sub pictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs)
' Create a local version of the graphics objectfor the PictureBox.
Dim g As Graphics = e.Graphics
' Draw a stringon the PictureBox.
g.DrawString("This is a diagonal line drawn on the control", _
New Font("Arial", 10), Brushes.Red, New PointF(30.0F, 30.0F))
' Draw a line in the PictureBox.
g.DrawLine(System.Drawing.Pens.Red, PictureBox1.Left, _
PictureBox1.Top, PictureBox1.Right, PictureBox1.Bottom)
End Sub 'pictureBox1_Paint
End Class
方法一:在窗体上打印文字
Dim g As Graphics = Me.CreateGraphicsDim mBrush As New SolidBrush(Color.Red)
Dim mFont As New Font("宋体", 18)
g.DrawString("测试", mFont, mBrush, 0, 10)
(0 为横坐标,10 为纵坐标)
方法二:在窗体上画文字
Dim m As Graphics
m = Me.CreateGraphics
m.DrawString("This is a diagonal line drawn on the control", _
New Font("Arial", 10), Brushes.Gold, New PointF(300.0F, 444.0F))
m.Dispose()
方法三:在图片框上打印文字
Public Class Form2
' This example creates a PictureBox control on the form and draws to it.
' This example assumes that the Form_Load event handler method is connected
' to the Load eventof the form.
Private pictureBox1 As New PictureBox()
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' Dock the PictureBox to the form andset its background to white.
pictureBox1.Dock = DockStyle.Fill
pictureBox1.BackColor = Color.White
' Connect the Paint eventof the PictureBox to the event handler method.
Ø AddHandler pictureBox1.Paint, AddressOf Me.pictureBox1_Paint
' Add the PictureBox control to the Form.
Me.Controls.Add(pictureBox1)
End Sub 'Form1_Load
00:00:03.9522260
Private Sub pictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs)
' Create a local version of the graphics objectfor the PictureBox.
Dim g As Graphics = e.Graphics
' Draw a stringon the PictureBox.
g.DrawString("This is a diagonal line drawn on the control", _
New Font("Arial", 10), Brushes.Red, New PointF(30.0F, 30.0F))
' Draw a line in the PictureBox.
g.DrawLine(System.Drawing.Pens.Red, PictureBox1.Left, _
PictureBox1.Top, PictureBox1.Right, PictureBox1.Bottom)
End Sub 'pictureBox1_Paint
End Class
栏目列表
最新更新
求1000阶乘的结果末尾有多少个0
详解MyBatis延迟加载是如何实现的
IDEA 控制台中文乱码4种解决方案
SpringBoot中版本兼容性处理的实现示例
Spring的IOC解决程序耦合的实现
详解Spring多数据源如何切换
Java报错:UnsupportedOperationException in Col
使用Spring Batch实现批处理任务的详细教程
java中怎么将多个音频文件拼接合成一个
SpringBoot整合ES多个精确值查询 terms功能实
数据库审计与智能监控:从日志分析到异
SQL Server 中的数据类型隐式转换问题
SQL Server中T-SQL 数据类型转换详解
sqlserver 数据类型转换小实验
SQL Server数据类型转换方法
SQL Server 2017无法连接到服务器的问题解决
SQLServer地址搜索性能优化
Sql Server查询性能优化之不可小觑的书签查
SQL Server数据库的高性能优化经验总结
SQL SERVER性能优化综述(很好的总结,不要错
uniapp/H5 获取手机桌面壁纸 (静态壁纸)
[前端] DNS解析与优化
为什么在js中需要添加addEventListener()?
JS模块化系统
js通过Object.defineProperty() 定义和控制对象
这是目前我见过最好的跨域解决方案!
减少回流与重绘
减少回流与重绘
如何使用KrpanoToolJS在浏览器切图
performance.now() 与 Date.now() 对比