Dim i As Integer
Dim k() As Integer
Dim Bmp
Dim Gra
bmp = New Bitmap(640, 480) '定义Bitmap对象
gra = Graphics.FromImage(bmp) '获取Graphices对象
Me.PictureBox1.Image = Bmp '让画出来的图片显示在窗体上的pic控件上
'定义画线用的画笔
Dim ppen As Pen = New Pen(Color.Black, 1)
'定义写字用的刷子
Dim dotUserBrush As SolidBrush = New SolidBrush(Color.Blue)
'画线
For i = 10 To 1000 Step 3
Gra.DrawLine(ppen, i, 100 + 1 * i, i * 2, 100 + 100 * i) '最上头的横线
Next
'''''''
Dim FFamily As FontFamily = New FontFamily("宋体")
Dim font As Font = New Font(FFamily, "12", FontStyle.Regular, FontStyle.Italic, GraphicsUnit.Pixel)
Dim text As String = "你输出的文字"
Dim solidbrush As SolidBrush = New SolidBrush(Color.Black)
Dim pr As PointF
'在图片上写字
pr = New PointF(10, 50)
Gra.DrawString(text, font, solidbrush, pr)
'画矩形
Gra.FillRectangle(solidbrush, 300, 400, 20, 20)
'打印图片标题
text = "销售操作图"
pr = New PointF(10, 10)
font = New Font(FFamily, "15", FontStyle.Bold, FontStyle.Regular, FontStyle.Italic, GraphicsUnit.Pixel)
Gra.DrawString(text, font, solidbrush, pr)
'画椭圆
Gra.FillEllipse(solidbrush, 200, 300, 50, 60)
'保存图片的方法
'bmp.Save("c:\genImage.jpg")
'Return "genImage.jpg"
End Sub
发表评论