vb.net Bitmap Drawing


Public Class Form1
	Dim BMP As New Drawing.Bitmap(640,480)
	Dim GFX As Graphics = Graphics.FromImage(BMP)
	Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button1.Click
		FX.FillRectangle(Brushes.White,PictureBox1.Width,PictureBox1.Height)
		GFX.DrawLine(Pens.Red,10,50,50)
		GFX.DrawString("Robomatics",SystemFonts.DefaultFont,Brushes.Black,60,60)
		PictureBox1.Image = BMP
	End Sub
	Private Sub PictureBox1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles PictureBox1.Click
		BMP.SetPixel(MousePosition.X - Me.Location.X - PictureBox1.Location.X - 4,MousePosition.Y - Me.Location.Y - PictureBox1.Location.Y - 30,Color.Black)
		GFX.DrawString("Robomatics",MousePosition.X - Me.Location.X - PictureBox1.Location.X - 4,MousePosition.Y - 	Me.Location.Y - PictureBox1.Location.Y - 30)
		PictureBox1.Image = BMP
	End Sub
End Class

相关文章

Format[$] ( expr [ , fmt ] ) format 返回变体型 format$ 强...
VB6或者ASP 格式化时间为 MM/dd/yyyy 格式,竟然没有好的办...
在项目中添加如下代码:新建窗口来显示异常信息。 Namespace...
转了这一篇文章,原来一直想用C#做k3的插件开发,vb没有C#用...
Sub 分列() ‘以空格为分隔符,连续空格只算1个。对所选...
  窗体代码 1 Private Sub Text1_OLEDragDrop(Data As Dat...